Skip to content

metrics

calc_metric_ensemble(ens, pst, metric='all', bygroups=True, subset_realizations=None, drop_zero_weight=True)

Calculates unweighted metrics to quantify fit to observations for ensemble members

Parameters:

Name Type Description Default
ens pandas DataFrame

DataFrame read from an observation

required
pst pyemu.Pst object

needed to obtain observation values and weights

required
metric list of str

metric to calculate (PBIAS, RMSE, MSE, NSE, MAE, NRMSE_SD, NRMSE_MEAN, NRMSE_IQ, NRMSE_MAXMIN) case insensitive Defaults to 'all' which calculates all available metrics

'all'
bygroups Bool

Flag to summarize by groups or not. Defaults to True.

True
subset_realizations iterable

Subset of realizations for which to report metric. Defaults to None which returns all realizations.

None
drop_zero_weight Bool

flag to exclude zero-weighted observations

True

Returns: pandas.DataFrame: rows are realizations. Columns are groups. Content is requested metrics

calc_metric_res(res, metric='all', bygroups=True, drop_zero_weight=True)

Calculates unweighted metrics to quantify fit to observations for residuals

Parameters:

Name Type Description Default
res pandas DataFrame or filename

DataFrame read from a residuals file or filename

required
metric list of str

metric to calculate (PBIAS, RMSE, MSE, NSE, MAE, NRMSE_SD, NRMSE_MEAN, NRMSE_IQ, NRMSE_MAXMIN) case insensitive Defaults to 'all' which calculates all available metrics

'all'
bygroups Bool

Flag to summarize by groups or not. Defaults to True.

True
drop_zero_weight Bool

flag to exclude zero-weighted observations

True

Returns:

Type Description

pandas.DataFrame: single row. Columns are groups. Content is requested metrics