sup3r.qa.utilities.time_derivative_dist#
- time_derivative_dist(var, bins=40, range=None, diff_max=None, t_steps=1, scale=1, percentile=99.9, interpolate=False, period=None)[source]#
Returns the time derivative distribution for the given variable.
- Parameters:
var (ndarray) – (lat, lon, temporal)
bins (int) – Number of bins for the time derivative pdf.
range (tuple | None) – Optional min/max range for the time derivative pdf.
diff_max (float) – Max value to keep for time derivative
t_steps (int) – Number of time steps to use for differences. e.g. If t_steps=1 this uses var[i + 1] - [i] to compute time derivatives.
scale (int) – Factor to scale the distribution by. This is used so that distributions from data with different resolutions can be compared. For instance, if this is calculating a time derivative distribution from data with a temporal resolution of 15min then the distribution needs to be scaled by 15min to compare to another scaled time derivative distribution with a different resolution
percentile (float) – Percentile to use to determine the maximum allowable value in the distribution. e.g. percentile=99 eliminates values above the 99th percentile from the histogram.
interpolate (bool) – Whether to interpolate over histogram counts. e.g. if a bin has count = 0 and surrounding bins have count > 0 the bin with count = 0 will have an interpolated value.
period (float | None) – If variable is periodic this gives that period. e.g. If the variable is winddirection the period is 360 degrees and we need to account for 0 and 360 being close.
- Returns:
ndarray – d(var) / dt values at bin centers
ndarray – d(var) / dt value counts
float – Normalization factor