sup3r.bias.mixins.ZeroRateMixin
- class ZeroRateMixin[source]
Bases:
object
Estimate zero rate
References
Methods
zero_precipitation_rate
(arr[, threshold])Rate of (nearly) zero precipitation days
- static zero_precipitation_rate(arr: ndarray, threshold: float = 0.0)[source]
Rate of (nearly) zero precipitation days
Estimate the rate of values less than a given
threshold
. In concept the threshold would be zero (thus the name zero precipitation rate) but it is often used a small threshold to truncate negligible values. For instance, [Pierce2015] uses 0.01 mm/day for PresRat correction.- Parameters:
arr (np.ndarray) – An array of values to be analyzed. Usually precipitation but it could be applied to other quantities.
threshold (float) – Minimum value accepted. Less than that is assumed to be zero.
- Returns:
rate (float) – Rate of days with negligible precipitation (see Z_gf in [Pierce2015]).
Notes
The
NaN
are ignored for the rate estimate. Therefore, a large number ofNaN
might compromise the confidence of the estimator.If the input values are all non-finite, it returns NaN.
Examples
>>> ZeroRateMixin().zero_precipitation_rate([2, 3, 4], 1) 0.0
>>> ZeroRateMixin().zero_precipitation_rate([0, 1, 2, 3], 1) 0.25
>>> ZeroRateMixin().zero_precipitation_rate([0, 1, 2, 3, np.nan], 1) 0.25