climpred.metrics._contingency

climpred.metrics._contingency(forecast, verif, score='table', dim=None, **metric_kwargs)[source]

Contingency table.

Parameters
  • forecast (xr.object) – Raw forecasts.

  • verif (xr.object) – Verification data.

  • dim (list or str) – Dimensions to aggregate.

  • score (str) – Score derived from contingency table. Attribute from Contingency. Use score=table to return a contingency table or any other contingency score, e.g. score=hit_rate.

  • observation_category_edges (array_like) – Category bin edges used to compute the observations CDFs. Bins include the left most edge, but not the right. Passed via metric_kwargs.

  • forecast_category_edges (array_like) – Category bin edges used to compute the forecast CDFs. Bins include the left most edge, but not the right. Passed via metric_kwargs

See also

References

Example

>>> category_edges = np.array([-0.5, 0., .5, 1.])
>>> hindcast.verify(metric='contingency', score='table', comparison='m2o',
        dim=[], alignment='same_verifs',
        observation_category_edges=category_edges,
        forecast_category_edges=category_edges)
>>> perfect_model.verify(metric='contingency', score='hit_rate',
        comparison='m2c', dim=['member','init'],
        observation_category_edges=category_edges,
        forecast_category_edges=category_edges)