nwm_metrics.event_metric_functions.event_based_metrics#

nwm_metrics.event_metric_functions.event_based_metrics(y_true, y_pred, threshold, aggregation='mean', separate_compound=True, virtual_strategy='both', plot=False, plot_filename=None)[source]#

Compute event-based metrics: PKBIAS, PKTE, EVBIAS. Optionally, plot time series with event markers.

Return type:

Dict[str, float]

Parameters:
  • y_true – observed streamflow series

  • y_pred – simulated streamflow series

  • threshold – flow threshold for event detection

  • aggregation – method to aggregate metrics across events (“mean” or “median”)

  • separate_compound – whether to separate compound events into single-peak events

  • virtual_strategy – strategy for handling unmatched events by creating virtual events (“none”, “obs”, “mod”, “both”)

  • plot – whether to plot time series with event markers

  • plot_filename – filename for saving the plot (if plot=True)

Returns:

Dictionary with keys “PKBIAS”, “PKTE”, and “EVBIAS” containing the corresponding metric values.