Performance metrics

Model-performance metrics comparing observed and simulated series.

class pyrunoff.metrics.KgeResult(kge, corr_coef, gamma, beta)[source]

Bases: object

Kling–Gupta Efficiency score and its component statistics.

Parameters:
  • kge (float) – Overall KGE′ score.

  • corr_coef (float) – Correlation between observed and simulated values.

  • gamma (float) – Ratio of coefficients of variation.

  • beta (float) – Ratio of means.

classmethod empty()[source]

Return a result whose score and components are all undefined.

Return type:

KgeResult

pyrunoff.metrics.nse(observed_data, simulated_data, use_low_flow_transform=False, low_flow_percentile=25)[source]

Calculate the Nash–Sutcliffe Efficiency (NSE).

The series are aligned by index, and pairs with a missing value are omitted.

Parameters:
  • observed_data (Series) – Observed values indexed by time.

  • simulated_data (Series) – Simulated values indexed by time.

  • use_low_flow_transform (bool) – Whether to apply the log-sinh transform before calculating the metric.

  • low_flow_percentile (float) – Percentile of positive observed values used as the transform scale. Must be between 0 and 100; the default is 25.

Returns:

NSE value, or numpy.nan when observed values have zero variance.

Return type:

float

pyrunoff.metrics.kge(observed_data, simulated_data, use_low_flow_transform=False, low_flow_percentile=25)[source]

Calculate the 2012 Kling–Gupta Efficiency (KGE′) and its components.

The series are aligned by index, and pairs with a missing value are omitted.

Parameters:
  • observed_data (Series) – Observed values indexed by time.

  • simulated_data (Series) – Simulated values indexed by time.

  • use_low_flow_transform (bool) – Whether to apply the log-sinh transform before calculating the metric.

  • low_flow_percentile (float) – Percentile of positive observed values used as the transform scale. Must be between 0 and 100; the default is 25.

Returns:

KGE′ score and component statistics. Undefined results are represented by numpy.nan values.

Return type:

KgeResult