# rex.bias_correction.qdm_ws

qdm_ws(ws, params_oh, params_mh, params_mf=None, dist='empirical', relative=True, sampling='linear', log_base=10)[source]

Correct windspeed using 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:
• ws (np.ndarray) – 2D array of windspeed values in shape (time, space)

• 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.

• params_mh (np.ndarray | list) – Same requirements as params_oh. This input arg is for the modeled historical distribution.

• params_mf (np.ndarray | list | None) – Same requirements as params_oh. This input arg is for the modeled future distribution. If this is None, this defaults to 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.

Returns:

ws (np.ndarray) – 2D array of windspeed values in shape (time, space)