rex.bias_correction.qdm_irrad
- qdm_irrad(ghi, dni, dhi, ghi_params_oh, dni_params_oh, ghi_params_mh, dni_params_mh, ghi_params_mf=None, dni_params_mf=None, dist='empirical', relative=True, sampling='linear', log_base=10, delta_denom_min=0.01, delta_denom_zero=None)[source]
Correct irradiance using the quantile delta mapping based on the method from Cannon et al., 2015
Cannon, A. J., Sobie, S. R. & Murdock, T. Q. Bias Correction of GCM Precipitation by Quantile Mapping: How Well Do Methods Preserve Changes in Quantiles and Extremes? Journal of Climate 28, 6938–6959 (2015).
- Parameters:
ghi (np.ndarray) – 2D array of global horizontal irradiance values in shape (time, space)
dni (np.ndarray) – 2D array of direct normal irradiance values in shape (time, space)
dhi (np.ndarray) – 2D array of diffuse horizontal irradiance values in shape (time, space)
ghi_params_oh (np.ndarray | list) – 2D array of observed historical distribution parameters created from a multi-year set of data where the shape is (space, N). This can be the output of a parametric distribution fit like
scipy.stats.weibull_min.fit()
where N is the number of parameters for that distribution, or this can define the x-values of N points from an empirical CDF that will be linearly interpolated between. If this is an empirical CDF, this must include the 0th and 100th percentile values and have even percentile spacing between values.dni_params_oh (np.ndarray | list) – Same requirements as ghi_params_oh. This input arg is for the observed historical distribution for DNI.
ghi_params_mh (np.ndarray | list) – Same requirements as ghi_params_oh. This input arg is for the modeled historical distribution for GHI.
dni_params_mh (np.ndarray | list) – Same requirements as ghi_params_oh. This input arg is for the modeled historical distribution for DNI.
ghi_params_mf (np.ndarray | list | None) – Same requirements as ghi_params_oh. This input arg is for the modeled future distribution for GHI. If this is None, this defaults to ghi_params_mh (no future data, just corrected to modeled historical distribution)
dni_params_mf (np.ndarray | list | None) – Same requirements as ghi_params_oh. This input arg is for the modeled future distribution for DNI. If this is None, this defaults to dni_params_mh. (no future data, just corrected to modeled historical distribution)
dist (str | np.ndarray) – Probability distribution name to use to model the data which determines how the param args are used. This can “empirical” or any continuous distribution name from
scipy.stats
. Can also be a 1D array of dist inputs if being used from reV, but they must all be the same option.relative (bool | np.ndarray) – Flag to preserve relative rather than absolute changes in quantiles. relative=False (default) will multiply by the change in quantiles while relative=True will add. See Equations 4-6 from Cannon et al., 2015 for more details. Can also be a 1D array of dist inputs if being used from reV, but they must all be the same option.
sampling (str | np.ndarray) – If dist=”empirical”, this is an option for how the quantiles were sampled to produce the params inputs, e.g., how to sample the y-axis of the distribution (see sampling functions in
rex.utilities.bc_utils
). “linear” will do even spacing, “log” will concentrate samples near quantile=0, and “invlog” will concentrate samples near quantile=1. Can also be a 1D array of dist inputs if being used from reV, but they must all be the same option.log_base (int | float | np.ndarray) – Log base value if sampling is “log” or “invlog”. A higher value will concentrate more samples at the extreme sides of the distribution. Can also be a 1D array of dist inputs if being used from reV, but they must all be the same option.
delta_denom_min (float | None) – Option to specify a minimum value for the denominator term in the calculation of a relative delta value. This prevents division by a very small number making delta blow up and resulting in very large output bias corrected values. See equation 4 of Cannon et al., 2015 for the delta term.
delta_denom_zero (float | None) – Option to specify a value to replace zeros in the denominator term in the calculation of a relative delta value. This prevents division by a very small number making delta blow up and resulting in very large output bias corrected values. See equation 4 of Cannon et al., 2015 for the delta term.
- Returns:
ghi (np.ndarray) – 2D array of global horizontal irradiance values in shape (time, space)
dni (np.ndarray) – 2D array of direct normal irradiance values in shape (time, space)
dhi (np.ndarray) – 2D array of diffuse horizontal irradiance values in shape (time, space)