xskillscore.crps_gaussian¶
- xskillscore.crps_gaussian(observations, mu, sig, dim=None, weights=None, keep_attrs=False)¶
Continuous Ranked Probability Score with a Gaussian distribution.
- Parameters
observations (xarray.Dataset or xarray.DataArray) – The observations or set of observations.
mu (xarray.Dataset or xarray.DataArray) – The mean of the forecast normal distribution.
sig (xarray.Dataset or xarray.DataArray) – The standard deviation of the forecast distribution.
dim (str or list of str, optional) – Dimension over which to compute mean after computing
crps_gaussian
. 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.
- Returns
- Return type
xarray.Dataset or xarray.DataArray reduced by dimension dim
Examples
>>> observations = xr.DataArray(np.random.normal(size=(3,3)), ... coords=[('x', np.arange(3)), ... ('y', np.arange(3))]) >>> forecasts = xr.DataArray(np.random.normal(size=(3,3,3)), ... coords=[('x', np.arange(3)), ... ('y', np.arange(3)), ... ('member', np.arange(3))]) >>> mu = forecasts.mean('member') >>> sig = forecasts.std('member') >>> crps_gaussian(observations, mu, sig, dim='x') <xarray.DataArray (y: 3)> array([1.0349773 , 0.36521376, 0.39017126]) Coordinates: * y (y) int64 0 1 2
See also
properscoring.crps_gaussian