wrfhydropy.Evaluation.contingency

Evaluation.contingency(threshold: float | str, time_window: str | None = None, mod_col: str = 'modeled', obs_col: str = 'observed', group_by: list | str | None = None, inf_as_na: bool = True, decimals: int = 2)[source]

Calculate contingency statistics

Accuracy (acc, fraction correct) = (hits + correct_negatives)/total Bias score (bias, frequency bias) = (hits + false_alarms)/(hits + misses) Probability of detection (pod, hit rate) = hits/(hits + misses) False alarm ratio (far) = false_alarms/(hits + false_alarms) Probability of false detection (pofd, false alarm rate) = false_alarms/(false_alarms + correct_negatives) Success ratio (sr) = hits/(hits + false_alarms) Critical success index (csi, threat score) = hits/(hits + misses + false_alarms) Gilbert skill score (gss, Equitable threat score) = (hits - hits_random)/(hits + misses + false_alarms - hits_random) where hits_random = ((hits + misses)*(hits + false_alarms))/total Hanssen and Kuipers discriminant (hk, Peirce’s skill score) = (hits/( hits+misses)) - (false_alarms/(false_alarms + correct_negatives)) Odds ratio (or) = (POD/(1-POD))/(POFD/(1-POFD)) Odds ratio skill score (orss, Yule’s Q) = ((hits * correct_negatives) - (misses * false_alarms))/((hits * correct_negatives) + (misses * false_alarms)

Parameters:
  • threshold – The threshold value for contingency stats or column name

  • in self.data containing threshold value. The first value of the

  • column will be used as the threshold value.

  • TODO JLM – I Do NOT love an entire column where a single value is used. I guess this allows different thresholds for different groups within the data.frame.

  • time_window – Calculate contingency statistics over a moving

  • time window of specified width in seconds (‘s’), hours (‘h’)

  • or days (‘d’)

  • mod_col – Column name of modelled data

  • obs_col – Column name of observed data

  • group_by – Column names to group by prior to calculating statistics

  • inf_as_na – convert inf values to na?

  • decimals – round stats to specified decimal places

Returns:

Pandas dataframe containing contingency statistics