Skip to content

spread_skill_ratio

Import path: earth2studio.statistics.spread_skill_ratio

View source on GitHub

Documentation

Metric for calculating the spread/skill ratio of an ensemble forecast.

Specifically, the spread is defined as the standard deviation of the ensemble forecast. The skill is defined as the rmse of the ensemble mean prediction. The ratio of these two quantities is defined as the spread/skill ratio.

Parameters:

  • ensemble_dimension (str) –

    The dimension over which the spread and skill are calculated over. This should usually be "ensemble".

  • reduction_dimensions (list[str]) –

    Dimensions to reduce (mean) the spread/skill ratio over. This is commonly done over time but can also be the globe or some region. Example: ['time', 'lat', 'lon']

  • ensemble_weights (Tensor | ndarray | None, default: None ) –

    A one-dimensional array containing weights to assign to the ensemble_dimension, by default None.

  • reduction_weights (Tensor | ndarray | None, default: None ) –

    An array containing weights to assign to the reduction dimensions. Note that these weights must have the same number of dimensions as passed in reduction_dimensions. Example: if reduction_dimensions = ['lat', 'lon'] then assert weights.ndim == 2. Ignored if None, by default None.

  • ensemble_batch_update (bool, default: False ) –

    Whether to apply batch updates to the ensemble mean and variance components of the spread and skill with each invocation of call. This is particularly useful when ensemble data is received in a stream of batches. Each invocation of call will return the running spread/skill ratio., by default False.

  • reduction_batch_update (bool, default: False ) –

    Whether to apply batch updates to the reduction rmse and averaging components of the spread/skill with each invocation of call. This is particularly useful when time data is received in a stream of batches., by default False.

__call__

__call__(x: DataArray, y: DataArray) -> DataArray

Apply metric to data x and y, reducing over reduction_dims. y must have every dimension of x except the ensemble dimension, if the metric has one, with matching coordinate values; it is transposed to x's order, not broadcast.

If batch_update was passed True upon metric initialization then this method returns the running sample RMSE over all seen batches.

Parameters:

  • x (DataArray) –

    The ensemble forecast input array. This is the array over which the ensemble mean and spread are calculated with respect to. reduction_dimensions must be in the dimensions of x.

  • y (DataArray) –

    The observation input array.

Returns:

  • DataArray –

    Returns spread/skill ratio array with appropriate reduced coordinates.