def read_parfiles(self, parfile_names): """ read the ensemble from par files Parameters: ---------- parfile_names: (list[str]) list of par files to load Note: ---- log transforms after loading according and possibly resets self.__istransformed """ par_dfs = [] for pfile in parfile_names: assert os.path.exists(pfile),"ParameterEnsemble.read_parfiles() error: " +\ "file: {0} not found".format(pfile) df = read_parfile(pfile) self.loc[pfile] = df.loc[:, 'parval1'] self.loc[:, :] = self.loc[:, :].astype(np.float64)
def parrep(self, parfile=None): """replicates the pest parrep util. replaces the parval1 field in the parameter data section dataframe Parameters: ---------- parfile (str) : parameter file to use. If None, try to use a parameter file that corresponds to the case name Returns: ------- None """ if parfile is None: parfile = self.filename.replace(".pst", ".par") par_df = pst_utils.read_parfile(parfile) self.parameter_data.index = self.parameter_data.parnme par_df.index = par_df.parnme self.parameter_data.parval1 = par_df.parval1 self.parameter_data.scale = par_df.scale self.parameter_data.offset = par_df.offset
def read_parfiles(self,parfile_names): """ read the ensemble from par files Parameters: ---------- parfile_names: (list[str]) list of par files to load Note: ---- log transforms after loading according and possibly resets self.__istransformed """ par_dfs = [] for pfile in parfile_names: assert os.path.exists(pfile),"ParameterEnsemble.read_parfiles() error: " +\ "file: {0} not found".format(pfile) df = read_parfile(pfile) self.loc[pfile] = df.loc[:,'parval1'] self.loc[:,:] = self.loc[:,:].astype(np.float64)
def read_parfiles(self, parfile_names): """ read the ParameterEnsemble realizations from par files. Used to fill the ParameterEnsemble with realizations from PEST-type par files Parameters ---------- parfile_names: list list of par files to load Note ---- log transforms after loading according and possibly resets self.__istransformed """ for pfile in parfile_names: assert os.path.exists(pfile),"ParameterEnsemble.read_parfiles() error: " +\ "file: {0} not found".format(pfile) df = read_parfile(pfile) self.loc[pfile] = df.loc[:, 'parval1'] self.loc[:, :] = self.loc[:, :].astype(np.float64)