earthkit.meteo.score.xarray.pearson_correlation¶
- earthkit.meteo.score.xarray.pearson_correlation(fcst, obs, over, weights=None)¶
Calculates the Pearson correlation between a forecast and observations.
Warning
Experimental API. This function may change or be removed without notice.
The correlation is defined as:
\[c = \frac{ \sum_{i=1}^N {\left(f-\overline{f}\right)\left(o-\overline{o}\right)} } {\sqrt{ \overline{\left(f-\overline{f}\right)^2} \ \overline{\left(o-\overline{o}\right)^2} }}\]where the averaging operator is defined as:
\[\overline{x} = \frac{\sum_{i=1}^N x_i w_i}{\sum_{i=1}^N w_i}\]and
\(f_i\) is the forecast,
\(o_i\) are the observations,
\(w_i\) are the weights,
\(c\) is the correlation.
- Parameters:
fcst (
xarray object) – The forecast xarray.obs (
xarray object) – The observations xarray.over (
strorlistofstr) – The dimension(s) over which to aggregate.weights (
xarray object, optional) – Weights to apply during aggregation. Default is None.
- Returns:
The correlation between the forecast and observations.
- Return type:
xarray object