sup3r.bias.utilities.lin_bc

Contents

sup3r.bias.utilities.lin_bc#

lin_bc(handler, bc_files, bias_feature=None, threshold=0.1)[source]#

Bias correct the data in this DataHandler in place using linear bias correction factors from files output by MonthlyLinearCorrection or LinearCorrection from sup3r.bias.bias_calc

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 MonthlyLinearCorrection or LinearCorrection. These should contain datasets named “{feature}_scalar” and “{feature}_adder” 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 is length 1 for annual correction or 12 for monthly correction.

  • bias_feature (str | None) – Name of the feature used as a reference. Dataset with name “base_{bias_feature}_scalar” and “base_{bias_feature}_adder” will be retrieved from bc_files.

  • threshold (float) – 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.