climpred.metrics._reliability¶
-
climpred.metrics.
_reliability
(forecast, verif, dim=None, **metric_kwargs)[source]¶ Returns the data required to construct the reliability diagram for an event. The the relative frequencies of occurrence of an event for a range of forecast probability bins.
- Parameters
forecast (xr.object) – Raw forecasts with
member
dimension if logical provided in metric_kwargs. Probability forecasts in [0,1] if logical is not provided.verif (xr.object) – Verification data without
member
dim. Raw verification if logical provided, else binary verification.dim (list or str) – Dimensions to aggregate. Requires member if logical provided in metric_kwargs to create probability forecasts. If logical not provided in metric_kwargs, should not include member.
logical (callable, optional) – Function with bool result to be applied to verification data and forecasts and then
mean('member')
to get forecasts and verification data in interval [0,1]. Passed via metric_kwargs.probability_bin_edges (array_like, optional) – Probability bin edges used to compute the reliability. Bins include the left most edge, but not the right. Passed via metric_kwargs. Defaults to 6 equally spaced edges between 0 and 1+1e-8.
- Returns
- The relative frequency of occurrence for each
probability bin
- Return type
reliability (xr.object)
- Details:
perfect
flat distribution
See also
Example
Define a boolean/logical function for binary scoring:
>>> def pos(x): return x > 0 # checking binary outcomes
Option 1. Pass with keyword logical: (Works also for PerfectModelEnsemble)
>>> hindcast.verify(metric='reliability', comparison='m2o', dim=['member','init'], alignment='same_verifs', logical=pos)
Option 2. Pre-process to generate a binary forecast and verification product:
>>> hindcast.map(pos).verify(metric='reliability', comparison='m2o', dim=['member','init'], alignment='same_verifs')
Option 3. Pre-process to generate a probability forecast and binary verification product. Because member no present in hindcast, use
comparison='e2o'
anddim='init'
:>>> hindcast.map(pos).mean('member').verify(metric='reliability', comparison='e2o', dim='init', alignment='same_verifs')