earthkit.meteo.score.xarray.squared_error

earthkit.meteo.score.xarray.squared_error(fcst, obs, agg_method=None, agg_dim=None, agg_weights=None, is_angular=False)

Calculates the squared error between a forecast and observations.

Warning

Experimental API. This function may change or be removed without notice.

The squared error is defined as:

\[e_i = (f_i - o_i)^2\]

where:

  • \(f_i\) is the forecast,

  • \(o_i\) are the observations,

  • \(e_i\) is the absolute error.

See also

This function leverages the scores.continuous.mse function.

Parameters:
  • fcst (xarray object) – The forecast xarray.

  • obs (xarray object) – The observations xarray.

  • agg_method (str, optional) – The aggregation method to apply over agg_dim. Default is None, which means no aggregation.

  • agg_dim (str or list of str, optional) – The dimension(s) over which to aggregate. Default is None.

  • agg_weights (xarray object, optional) – Weights to apply during aggregation. Default is None.

  • is_angular (bool, optional) – Whether the data represents angular quantities in degrees. Default is False.

Returns:

The squared error between the forecast and observations, possibly aggregated.

Return type:

xarray object