xskillscore.crps_quadrature
- xskillscore.crps_quadrature(observations, cdf_or_dist, xmin=None, xmax=None, tol=1e-06, dim=None, weights=None, keep_attrs=False)
Continuous Ranked Probability Score with numerical integration of the normal distribution.
- Parameters:
observations (xarray.Dataset or xarray.DataArray) – Observations associated with the forecast distribution
cdf_or_dist
.cdf_or_dist (callable or scipy.stats.distribution) – Function which returns the cumulative density of the forecast distribution at value x.
xmin (see properscoring.crps_quadrature) –
xmax (see properscoring.crps_quadrature) –
tol (see properscoring.crps_quadrature) –
dim (str or list of str, optional) – Dimension over which to compute mean after computing
crps_quadrature
. Defaults to None implying averaging over all dimensions.weights (xr.DataArray with dimensions from dim, optional) – Weights for weighted.mean(dim). Defaults to None, such that no weighting is applied.
keep_attrs (bool) – 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.
- Return type:
Examples
>>> observations = xr.DataArray( ... np.random.normal(size=(3, 3)), ... coords=[("x", np.arange(3)), ("y", np.arange(3))], ... ) >>> from scipy.stats import norm >>> xs.crps_quadrature(observations, norm, dim="x") <xarray.DataArray (y: 3)> Size: 24B array([0.80280921, 0.31818197, 0.32364912]) Coordinates: * y (y) int64 24B 0 1 2
See also
properscoring.crps_quadrature