ens_mae¶
-
hydrostats.ens_metrics.
ens_mae
(obs, fcst_ens=None, remove_zero=False, remove_neg=False)¶ Calculate the mean absolute 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.
Returns: The mean absolute 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 ME between the ensemble mean and the observed data. Note that because the data is random the errors cancel out, leaving a low ME value.
>>> em.ens_mae(obs=observed_array, fcst_ens=ensemble_array) 26.35428724003365