nwm_metrics.metric_functions#

Module containing functions to calculate various metrics for evaluating hydrological model performance.

Functions:
  • treat_values: Preprocess time series data by removing negative values, NaN values, and replacing zero values.

  • pearson_corr: Calculate Pearson correlation coefficient and p-value between observed and simulated values.

  • mean_abs_error: Calculate mean absolute error between observed and simulated values.

  • root_mean_squared_error: Calculate root mean squared error or mean squared error between observed and simulated values.

  • rmse_std_ratio: Calculate the ratio of RMSE to the standard deviation of observed values.

  • percent_bias: Calculate percent bias between observed and simulated values.

  • nse: Calculate Nash-Sutcliffe efficiency, with options for logarithmic transformation and normalization.

  • weighted_nse: Calculate a weighted average of NSE and logarithmic NSE.

  • kge: Calculate Kling-Gupta efficiency between observed and simulated values.

  • pbias_fdc: Calculate percent bias of flow duration curve segments (high, medium, low flow) based on exceedance probabilities.

  • categorical_score: Calculate categorical scores (POD, FAR, CSI, FBIAS) based on a specified threshold.

  • calculate_metrics: A wrapper function to calculate multiple metrics at once based on user-specified metric names.

Functions

calculate_metrics

Compute all statistical metrics between simulation and observation.

categorical_score

Compute probability of detection (POD), probability of false_alarm (FAR), cirtical success index (CSI) and frequency bias (FBIAS).

get_threshold_value

Get threshold value based on the specified threshold type and value.

kge

Compute Kling-Gupta efficiency between simulation and observation.

mean_abs_error

Compute mean absolute error between simulation and observation.

nse

Compute Nash-Sutcliffe efficiency.

pbias_fdc

Compute percent bias of flow duration curve (FDC) high-segment volume, midsegment slope and low-segment volume according to Yilmaz et al (2008).

pearson_corr

Compute mean squared error, or optionally root mean squared error.

percent_bias

Compute mean squared error, or optionally root mean squared error.

rmse_std_ratio

Compute ratio of RMSE between simulation and observation to standard deviation of observation.

root_mean_squared_error

Compute root mean squared error, or optionally mean squared error.

treat_values

Remove NaN, inf and negative values, and replace zero values of time series.

weighted_nse

Compute weighted average of NSE of raw time series and NSE of logrithmic time series.