kge_2012¶
-
HydroErr.HydroErr.
kge_2012
(simulated_array, observed_array, s=(1, 1, 1), replace_nan=None, replace_inf=None, remove_neg=False, remove_zero=False, return_all=False)¶ Compute the Kling-Gupta efficiency (2012).
Range: -inf < KGE (2012) < 1, does not indicate bias, larger is better.
Notes: The modified version of the KGE (2009). Kling proposed this version to avoid cross-correlation between bias and variability ratios.
Parameters: - simulated_array (one dimensional ndarray) – An array of simulated data from the time series.
- observed_array (one dimensional ndarray) – An array of observed data from the time series.
- s (tuple of length three) – Represents the scaling factors to be used for re-scaling the Pearson product-moment correlation coefficient (r), gamma, and Beta, respectively.
- replace_nan (float, optional) – If given, indicates which value to replace NaN values with in the two arrays. If None, when a NaN value is found at the i-th position in the observed OR simulated array, the i-th value of the observed and simulated array are removed before the computation.
- replace_inf (float, optional) – If given, indicates which value to replace Inf values with in the two arrays. If None, when an inf value is found at the i-th position in the observed OR simulated array, the i-th value of the observed and simulated array are removed before the computation.
- remove_neg (boolean, optional) – If True, when a negative value is found at the i-th position in the observed OR simulated array, the i-th value of the observed AND simulated array are removed before the computation.
- remove_zero (boolean, optional) – If true, when a zero value is found at the i-th position in the observed OR simulated array, the i-th value of the observed AND simulated array are removed before the computation.
- return_all (bool) – If True, returns all of the components of the KGE metric, which are r, gamma, and beta, respectively.
Returns: The Kling-Gupta (2012) efficiency value, unless the return_all parameter is True.
Return type: float (tuple of float)
Examples
>>> import HydroErr as he >>> import numpy as np
>>> sim = np.array([5, 7, 9, 2, 4.5, 6.7]) >>> obs = np.array([4.7, 6, 10, 2.5, 4, 6.8]) >>> he.kge_2012(sim, obs) 0.9122230723456678
>>> he.kge_2012(sim, obs, return_all=True) # Returns (r, alpha, beta, kge) (0.9615951377405804, 0.9224843295231272, 1.0058823529411764, 0.9132923608280753)
References
- Kling, H., Fuchs, M., & Paulin, M. (2012). Runoff conditions in the upper Danube basin under an ensemble of climate change scenarios. Journal of Hydrology, 424, 264-277.