Best
- class smartpy.montecarlo.Best(catchment, root_f, in_format, out_format, target, nb_best, constraining=None, parallel='seq', save_sim=False, settings_filename=None, decompression_csv=False)
Best is the available to condition a sample of parameter sets by selecting the best performing parameter set(s) based on a given objective function used as target.
Important
A sampling must have already been performed prior to using this functionality, and the conditioned sample is then used to run the model on a different simulation period than the sampling simulation period.
Instantiation
- Parameters
- catchment:
str
A name to identify the catchment of interest in the inputs and outputs directories.
- root_f:
str
The file path to the directory containing the model inputs and outputs. Note that a specific internal structure for this directory must be followed:
root_f ├── in │ └── catchment │ ├── catchment.rain │ ├── catchment.peva │ ├── catchment.flow │ └── catchment.sttngs └── out
- in_format:
str
The input file format. It can either be
'csv'
or'netcdf'
. Note that in either case, a specific file format must be followed.- out_format:
str
The output file format. It can either be
'csv'
or'netcdf'
.- target:
str
The name of the objective function to use as target for the determination of which parameter sets are the best at reproducing the observed river discharge. The options are:
‘NSE’
‘KGE’
‘KGEc’
r component of Kling-Gupta Efficiency.
‘KGEa’
alpha component of Kling-Gupta Efficiency.
‘KGEb’
beta component of Kling-Gupta Efficiency.
‘PBias’
Percent bias.
‘RMSE’
Root mean square error.
- nb_best:
int
The number of parameter sets to select as best. This can be any value between 1 and the sample_size.
- constraining:
dict
An option to filter the sample of parameter sets before selecting the best performing one(s). This is the same behaviour as conditioning in
montecarlo.GLUE
.Parameter example:
constraining={ 'GW': ['equal', (1,)] # GW = 1 }
Parameter example:
constraining={ 'PBias': ['inside', (-10, 10)], # -10% <= PBias <= 10% 'KGE': ['min', (0.6,)] # KGE >= 0.6 }
- parallel:
str
, optional Whether the sampling is to performed in parallel (i.e. using MPI calls to run several simulations at the same time), or in serial (i.e. running simulations sequentially one after another). The options are:
Parallel
Description
'seq'
Run the simulations one after another.
'mpi'
Run several simulations at the same time. The number of simultaneous simulations is determined with the number of processes using
mpirun -np
.If not provided, set to default value
'seq'
.- save_sim:
bool
, optional Whether to save the simulated discharge time series. If not provided, set to default value
False
(i.e. the simulated values are not recorded). Note that the sampled parameter values as well as a bundle of objective functions are always recorded in the sampling output file regardless of this argument.- settings_filename:
str
, optional The name of the settings file to use to configure the SMART model. This argument is to be used when the settings file does not follow the specific file name expected by the model, i.e. {root_f}/in/{catchment}.sttngs. If not provided, set to the specific file name expected. Note that regardless of this argument, the settings file must be in the inputs folder for the given catchment (in other words, absolute paths are not supported here).
- decompression_csv:
bool
, optional Whether the CSV files containing the sample of parameter sets is compressed or not. If it is, this must be set to
True
to decompress the CSV file as a pre-processing step. If not provided, set to default vaalueFalse
(i.e. no decompression).
- catchment: