isimip3: ISIMIP v3 method for bias correction

View source: R/isimip3.R

isimip3R Documentation

ISIMIP v3 method for bias correction

Description

Implementation of ISIMIP v3 method for bias correction: 1. Replaces invalid values in time series. 2. Detrends time series if desired. 3. Replaces values beyond thresholds by random numbers. 4. Adjusts inter-variable copula. 5. Adjusts marginal distributions for every variable. 6. Replaces values beyond thresholds by the respective bound. 7. Restores trends. Removes invalid values from masked arrays and store resulting numpy arrays

Usage

isimip3(
  o,
  p,
  s,
  dates,
  long_term_mean = NULL,
  lower_bound = c(NULL),
  lower_threshold = c(NULL),
  upper_bound = c(NULL),
  upper_threshold = c(NULL),
  randomization_seed = c(NULL),
  detrend = array(data = FALSE, dim = 1),
  rotation_matrices = c(NULL),
  n_quantiles = 50,
  distribution = c("normal"),
  trend_preservation = array(data = "additive", dim = 1),
  adjust_p_values = array(data = FALSE, dim = 1),
  if_all_invalid_use = c(NULL),
  invalid_value_warnings = FALSE,
  halfwin_upper_bound_climatology = 0
)

Arguments

o

A vector (e.g. station data) containing the observed climate data for the training period

p

A vector containing the simulated climate by the model for the training period.

s

A vector containing the simulated climate for the variable used in p, but considering the test period.

dates

List containing the dates corresponding to Observations (obs_hist), training period (sim_hist) and test period (sim_fut). Every array represents the years of the time steps of the time series data. Used for detrending.

long_term_mean

: dict of lists with keys 'obs_hist', 'sim_hist', 'sim_fut' Every value in every list represents the average of all valid values in the complete time series for one climate variable.

lower_bound

: list of floats, optional. Lower bounds of values in x_obs_hist, x_sim_hist, and x_sim_fut.

lower_threshold

: list of floats, optional. Lower thresholds of values in x_obs_hist, x_sim_hist, and x_sim_fut. All values below this threshold are replaced by random numbers between lower_bound and lower_threshold before bias adjustment.

upper_bound

: list of floats, optional. Upper bounds of values in x_obs_hist, x_sim_hist, and x_sim_fut.

upper_threshold

: list of floats, optional. Upper thresholds of values in x_obs_hist, x_sim_hist, and x_sim_fut. All values above this threshold are replaced by random numbers between upper_threshold and upper_bound before bias adjustment.

randomization_seed

: int, optional. Used to seed the random number generator before replacing invalid values and values beyond the specified thresholds.

detrend

: list of booleans, optional. Detrend time series before bias adjustment and put trend back in afterwards.

rotation_matrices

: list of (n,n) ndarrays, optional. List of orthogonal matrices defining a sequence of rotations in variable space, where n is the number of variables.

n_quantiles

: int, optional. Number of quantile-quantile pairs used for non-parametric quantile mapping.

distribution

: list of strs, optional. Kind of distribution used for parametric quantile mapping: "normal", "weibull", "gamma", "beta", "rice".

trend_preservation

: list of strs, optional. Kind of trend preservation used for non-parametric quantile mapping: "additive", "multiplicative", "mixed", "bounded".

adjust_p_values

: list of booleans, optional. Adjust p-values for a perfect match in the reference period.

if_all_invalid_use

: list of floats, optional. Used to replace invalid values if there are no valid values. An error is raised if there are no valid values and this parameter is None.

invalid_value_warnings

: boolean, optional. Raise user warnings when invalid values are replaced bafore bias adjustment.

halfwin_upper_bound_climatology

: Determines the lengths of running windows used in the calculations of climatologies of upper bounds that are used to scale values of obs_hist, sim_hist, and sim_fut to the interval [0,1] before bias adjustment. The window length is set to: halfwin_upper_bound_climatology * 2 + 1 time steps. If halfwin_upper_bound_climatology == 0 then no rescaling is done.

Author(s)

S. Herrera and M. Iturbide


SantanderMetGroup/downscaleR documentation built on Nov. 16, 2024, 1:35 a.m.