ens_mse¶
-
hydrostats.ens_metrics.
ens_mse
(obs, fcst_ens=None, remove_zero=False, remove_neg=False, reference='mean')¶ Calculate the mean squared error between observed values and the ensemble mean.
Parameters: - obs (1D ndarray) – Array of observations for each start date.
- fcst_ens (2D ndarray) – Array of ensemble forecast of dimension n x M, where n = number of start dates and M = number of ensemble members.
- remove_neg (bool) – If True, when a negative value is found at the i-th position in the observed OR ensemble array, the i-th value of the observed AND ensemble array are removed before the computation.
- remove_zero (bool) – If true, when a zero value is found at the i-th position in the observed OR ensemble array, the i-th value of the observed AND ensemble array are removed before the computation.
- reference (str) – Determines the reference series against which to calculate the error. Choices are ‘mean’ and ‘median’.
Returns: The mean error between the observed time series data and the ensemble mean.
Return type: float
Examples
>>> import numpy as np >>> import hydrostats.ens_metrics as em >>> np.random.seed(3849590438)
Creating an observed 1D array and an ensemble 2D array
>>> ensemble_array = (np.random.rand(100, 52) + 1) * 100 # 52 Ensembles >>> observed_array = (np.random.rand(100) + 1) * 100
Computing the MSE between the ensemble mean and the observed data
>>> em.ens_mse(obs=observed_array, fcst_ens=ensemble_array) 910.5648405687582