sup3r.bias.utilities.qdm_bc

Contents

sup3r.bias.utilities.qdm_bc#

qdm_bc(handler, bc_files, bias_feature, relative=True, threshold=0.1, no_trend=False)[source]#

Bias Correction using Quantile Delta Mapping

Bias correct this DataHandler’s data with Quantile Delta Mapping. The required statistical distributions should be pre-calculated using sup3r.bias.bias_calc.QuantileDeltaMappingCorrection.

Warning: There is no guarantee that the coefficients from bc_files match the resource processed here. Be careful choosing bc_files.

Parameters:
  • handler (DataHandler) – DataHandler instance with .data attribute containing data to bias correct

  • bc_files (list | tuple | str) – One or more filepaths to .h5 files output by bias_calc.QuantileDeltaMappingCorrection. These should contain datasets named “base_{bias_feature}_params”, “bias_{feature}_params”, and “bias_fut_{feature}_params” where {feature} is one of the features contained by this DataHandler and the data is a 3D array of shape (lat, lon, time) where time.

  • bias_feature (str) – Name of the feature used as (historical) reference. Dataset with name “base_{bias_feature}_params” will be retrieved from bc_files.

  • relative (bool, default=True) – Switcher to apply QDM as a relative (use True) or absolute (use False) correction value.

  • threshold (float, default=0.1) – Nearest neighbor euclidean distance threshold. If the DataHandler coordinates are more than this value away from the bias correction lat/lon, an error is raised.

  • no_trend (bool, default=False) – An option to ignore the trend component of the correction, thus resulting in an ordinary Quantile Mapping, i.e. corrects the bias by comparing the distributions of the biased dataset with a reference datasets. See params_mf of rex.utilities.bc_utils.QuantileDeltaMapping. Note that this assumes that “bias_{feature}_params” (params_mh) is the data distribution representative for the target data.