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

Calculate the Brier scores of an ensemble for exceeding given thresholds.

  • 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.

  • threshold (scalar or 1d scalar) – Threshold values at which to calculate exceedence Brier scores.

  • 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 threshold_brier_score. 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.


(If threshold is a scalar, the result will have the same shape as observations. Otherwise, it will have an additional final dimension corresponding to the threshold levels. Not implemented yet.)

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))])
>>> threshold = [.2, .5, .8]
>>> xs.threshold_brier_score(observations, forecasts, threshold)
<xarray.DataArray (threshold: 3)>
array([0.27160494, 0.34567901, 0.18518519])
  * threshold  (threshold) float64 0.2 0.5 0.8

See also



Gneiting, T. and Ranjan, R. Comparing density forecasts using threshold-

and quantile-weighted scoring rules. J. Bus. Econ. Stat. 29, 411-422 (2011). http://www.stat.washington.edu/research/reports/2008/tr533.pdf