calculate_all_metrics

postprocessinglib.evaluation.metrics.calculate_all_metrics(observed: DataFrame, simulated: Union[DataFrame, List[DataFrame]], stations: list[int] = [], format: str = '', out: str = 'metrics_out', metric_options: dict | None = None) DataFrame

Calculate all metrics.

Parameters:
  • observed (pd.DataFrame) – Observed values[1: Datetime ; 2+: Streamflow Values]

  • simulated (pd.DataFrame or list[pd.DataFrame]) – Simulated values[1: Datetime ; 2+: Streamflow Values]

  • stations (list[int]) – numbers pointing to the location of the stations in the list of stations. Values can be any number from 1 to number of stations in the data

  • format (str) – used to indicate that you want the output to be saved to a output file who’s name is specified by the ‘out’ parameter

  • out (str) – used in tandem with the ‘format’ parameter to specify the name of the output file. it is ‘metrics_out.{format}’ by default

  • metric_options (dict | None) –

    Per-metric keyword options passed to each metric function. For example:

    {
        "KGE": {"return_kge_components": True},
        "KGE 2012": {"return_kge_components": True},
    }
    

Returns:

DataFrame containing every metric that can be evaluated and

its result

Return type:

pd.DataFrame

Example

Calculation of all available metrics

>>> from postprocessinglib.evaluation import metrics, data
>>> path = 'MESH_output_streamflow_1.csv'
>>> DATAFRAMES = data.generate_dataframes(csv_fpath=path, warm_up=365)
>>> print(metrics.calculate_all_metrics(observed=DATAFRAMES["DF_OBSERVED"], simulated=DATAFRAMES["DF_SIMULATED"]))
                MSE         RMSE    MAE             NSE            NegNSE   LogNSE  NegLogNSE       KGE     NegKGE  KGE 2012        BIAS    AbsBIAS TTP_obs TTCoM_obs       SPOD_obs        TTP_sim_model1  TTCoM_sim_model1        SPOD_sim_model1
                model1          model1      model1      model1         model1       model1  model1  model1  model1  model1  model1  model1  ttp     ttcom   SPOD    ttp     ttcom   SPOD
    Station 1       1299.000        36.050  209200.0        0.51660   -0.51660      -0.25110        0.25110 0.50940 -0.50940        0.56060 34.160  34.160  157.0   NaN     113.0   171.0   185.0   128.0
    Station 2       780.600     27.940      29480.0     -1.67500   1.67500  -0.16920        0.16920 -0.11130        0.11130 0.08006 -11.500 11.500  157.0   NaN     NaN     177.0   166.0   115.0

JUPYTER NOTEBOOK Examples