xskillscore.crps_ensemble(observations, forecasts, member_weights=None, issorted=False, member_dim='member', dim=None, weights=None, keep_attrs=False)

Continuous Ranked Probability Score with the ensemble distribution.

  • observations (xarray.Dataset or xarray.DataArray) – The observations or set of observations.

  • forecasts (xarray.Dataset or xarray.DataArray) – Forecast with required member dimension member_dim.

  • member_weights (xarray.Dataset or xarray.DataArray) – If provided, the CRPS is calculated exactly with the assigned probability weights to each forecast. Weights should be positive, but do not need to be normalized. By default, each forecast is weighted equally.

  • issorted (bool, optional) – Optimization flag to indicate that the elements of ensemble are already sorted along axis.

  • member_dim (str, optional) – Name of ensemble member dimension. By default, ‘member’.

  • dim (str or list of str, optional) – Dimension over which to compute mean after computing crps_ensemble. 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

xarray.Dataset or xarray.DataArray


>>> 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))])
>>> crps_ensemble(observations, forecasts, dim='x')
<xarray.DataArray (y: 3)>
array([1.04497153, 0.48997746, 0.47994095])
  * y        (y) int64 0 1 2

See also