Skip to content

result_handler

ResultHandler

Bases: object

the result handling parent class - should not be instantiated directly

files_loaded property

get a sorted list of all the result files that have been loaded so far

__init__(m_d, case)

constructor

Parameters:

Name Type Description Default
m_d str

results directory

required
case str

the pest++ case name

required

check_dup_iters(itrs, files)

check that a sequence of results files does not have the same iteration tag in the filename. Raises exception of true

Parameters:

Name Type Description Default
itrs list

iteration numbers

required
files files

associated list of filenames

required

get_or_load_csv_file(filename, index_col=None)

get or optionally load a dataframe from a csv file

Parameters:

Name Type Description Default
fileanme str

full path filename

required
index_col int

optional column in the csv file to make the index

None

Returns:

Type Description

pd.DataFrame

get_or_load_ensemble_file(filename, index_name='realization')

get or optionally load an ensemble file into a pandas dataframe

Parameters:

Name Type Description Default
filename str

full path filename

required
index_name str

optional name to give the index in the dataframe

'realization'

Returns:

Type Description

pd.DataFrame

get_or_load_rmr_file(rmr_file)

special handling for parsing the rmr file into a dataframe

Parameters:

Name Type Description Default
rmr_file str

full path rmr filename

required

Returns:

Type Description

pd.DataFrame

parse_iter_from_tag(tag)

get the integer iteration/generation number for a user-supplied attr str

Parameters:

Name Type Description Default
tag str

user supplied attr string

required

Returns:

Type Description

int

ResultIesHandler

Bases: ResultHandler

pestpp-ies child result class

files_loaded property

get a sorted list of all the result files that have been loaded so far

__getattr__(tag)

overload of the get-attribute class method to make things super easy to use. your welcome

Parameters:

Name Type Description Default
tag str

the attribute string

required

Returns:

Type Description

varies

Note

raises lots of exceptions

__init__(m_d, case)

constructor

Parameters:

Name Type Description Default
m_d str

results directory

required
case str

the pest++ case name

required

check_dup_iters(itrs, files)

check that a sequence of results files does not have the same iteration tag in the filename. Raises exception of true

Parameters:

Name Type Description Default
itrs list

iteration numbers

required
files files

associated list of filenames

required

get(tag, *args)

helper to call getattr() with programatic args

Parameters:

Name Type Description Default
tag str

string for the item of interest (eg "paren", "dvpop", etc)

required
*args list

optional args to str concatenate with tag when passed to getattr(). for example tag could be "paren" and args could 0, so that what is passed to getattr() is "paren0".

()

Returns: "it depends"

get_files(tag)

find all files that contain the user-supplied attr string

Parameters:

Name Type Description Default
tag str

user supplied attr string

required

Returns:

Name Type Description
list str

list of filenames

get_or_load_csv_file(filename, index_col=None)

get or optionally load a dataframe from a csv file

Parameters:

Name Type Description Default
fileanme str

full path filename

required
index_col int

optional column in the csv file to make the index

None

Returns:

Type Description

pd.DataFrame

get_or_load_ensemble_file(filename, index_name='realization')

get or optionally load an ensemble file into a pandas dataframe

Parameters:

Name Type Description Default
filename str

full path filename

required
index_name str

optional name to give the index in the dataframe

'realization'

Returns:

Type Description

pd.DataFrame

get_or_load_rmr_file(rmr_file)

special handling for parsing the rmr file into a dataframe

Parameters:

Name Type Description Default
rmr_file str

full path rmr filename

required

Returns:

Type Description

pd.DataFrame

parse_iter_from_tag(tag)

get the integer iteration/generation number for a user-supplied attr str

Parameters:

Name Type Description Default
tag str

user supplied attr string

required

Returns:

Type Description

int

ResultMouHandler

Bases: ResultHandler

pestpp-mou child result class

files_loaded property

get a sorted list of all the result files that have been loaded so far

__getattr__(tag)

overload of the get-attribute class method to make things super easy to use. your welcome

Parameters:

Name Type Description Default
tag str

the attribute string

required

Returns:

Type Description

varies

Note

raises lots of exceptions

__init__(m_d, case)

constructor

Parameters:

Name Type Description Default
m_d str

results directory

required
case str

the pest++ case name

required

check_dup_iters(itrs, files)

check that a sequence of results files does not have the same iteration tag in the filename. Raises exception of true

Parameters:

Name Type Description Default
itrs list

iteration numbers

required
files files

associated list of filenames

required

get_files(tag)

find all files that contain the user-supplied attr string

Parameters:

Name Type Description Default
tag str

user supplied attr string

required

Returns:

Name Type Description
list str

list of filenames

get_or_load_csv_file(filename, index_col=None)

get or optionally load a dataframe from a csv file

Parameters:

Name Type Description Default
fileanme str

full path filename

required
index_col int

optional column in the csv file to make the index

None

Returns:

Type Description

pd.DataFrame

get_or_load_ensemble_file(filename, index_name='realization')

get or optionally load an ensemble file into a pandas dataframe

Parameters:

Name Type Description Default
filename str

full path filename

required
index_name str

optional name to give the index in the dataframe

'realization'

Returns:

Type Description

pd.DataFrame

get_or_load_rmr_file(rmr_file)

special handling for parsing the rmr file into a dataframe

Parameters:

Name Type Description Default
rmr_file str

full path rmr filename

required

Returns:

Type Description

pd.DataFrame

parse_iter_from_tag(tag)

get the integer iteration/generation number for a user-supplied attr str

Parameters:

Name Type Description Default
tag str

user supplied attr string

required

Returns:

Type Description

int

Results

Bases: object

high level result designed so that multiple results dirs can be handled at once

__init__(m_d, case=None)

constructor

Parameters:

Name Type Description Default
m_d str

results directory

required
case str

optional pest++ case. If None, a single .pst control file in m_d is sought. If not found, then exception is raised.

None