xskillscore.reliability¶
-
xskillscore.
reliability
(observations, forecasts, dim=None, probability_bin_edges=array([0.0, 0.2, 0.4, 0.60000001, 0.80000001, 1.00000001]), keep_attrs=False)¶ Returns the data required to construct the reliability diagram for an event; the relative frequencies of occurrence of an event for a range of forecast probability bins
- Parameters
observations (xarray.Dataset or xarray.DataArray) – The observations or set of observations of the event. Data should be boolean or logical (True or 1 for event occurance, False or 0 for non-occurance).
forecasts (xarray.Dataset or xarray.DataArray) – The forecast likelihoods of the event. Data should be between 0 and 1.
dim (str or list of str, optional) – Dimension(s) over which to compute the histograms Defaults to None meaning compute over all dimensions.
probability_bin_edges (array_like, optional) – Probability bin edges used to compute the reliability. Bins include the left most edge, but not the right. Defaults to 6 equally spaced edges between 0 and 1+1e-8
keep_attrs (bool, optional) – If True, the attributes (attrs) will be copied from the first input to the new one. If False (default), the new object will be returned without attributes.
- Returns
The relative frequency of occurrence for each probability bin
- Return type
Examples
>>> forecasts = xr.DataArray(np.random.normal(size=(3,3,3)), ... coords=[('x', np.arange(3)), ... ('y', np.arange(3)), ... ('member', np.arange(3))]) >>> observations = xr.DataArray(np.random.normal(size=(3,3)), ... coords=[('x', np.arange(3)), ... ('y', np.arange(3))]) >>> rel = reliability(observations > 0.1, (forecasts > 0.1).mean('ensemble'), dim='x')
Notes