View source: R/biasCorrection.R
biasCorrection | R Documentation |
Implementation of several standard bias correction methods
biasCorrection(
y,
x,
newdata = NULL,
precipitation = FALSE,
method = c("delta", "scaling", "eqm", "pqm", "gpqm", "loci", "dqm", "qdm", "isimip3"),
cross.val = c("none", "loo", "kfold"),
folds = NULL,
consecutive = TRUE,
window = NULL,
scaling.type = c("additive", "multiplicative"),
fitdistr.args = list(densfun = "normal"),
wet.threshold = 1,
n.quantiles = NULL,
extrapolation = c("none", "constant"),
theta = c(0.95, 0.05),
detrend = TRUE,
isimip3.args = NULL,
join.members = FALSE,
return.raw = FALSE,
interpGrid.args = list(),
parallel = FALSE,
max.ncores = 16,
ncores = NULL
)
y |
A grid or station data containing the observed climate data for the training period |
x |
A grid containing the simulated climate by the model for the training period. This can be either
the same variable as |
newdata |
A grid containing the simulated climate for the variables used in |
precipitation |
Logical for precipitation data (default to FALSE). If TRUE adjusts precipitation
frequency in 'x' (prediction) to the observed frequency in 'y' (see Details). To adjust the frequency,
parameter |
method |
method applied. Current accepted values are |
cross.val |
Logical (default to FALSE). Should cross-validation be performed? methods available are leave-one-out ("loo") and k-fold ("kfold") on an annual basis. The default option ("none") does not perform cross-validation. |
folds |
Only requiered if |
consecutive |
Default is TRUE. Create folds containing consecutive years? Only used if cross.val = "kfold" and folds is an integer. If FALSE, each years will be sampled randomly to create the folds. |
window |
vector of length = 2 (or 1) specifying the time window width used to calibrate and the
target days (days that are being corrected). The window is centered on the target day/s
(window width >= target days). Default to |
scaling.type |
Character indicating the type of the scaling method. Options are |
fitdistr.args |
Further arguments passed to function |
wet.threshold |
The minimum value that is considered as a non-zero precipitation. Ignored when
|
n.quantiles |
Integer indicating the number of quantiles to be considered when method = "eqm", "dqm", "qdm". Default is NULL,
that considers all quantiles, i.e. |
extrapolation |
Character indicating the extrapolation method to be applied to correct values in
|
theta |
numeric indicating upper threshold (and lower for the left tail of the distributions, if needed)
above which precipitation (temperature) values are fitted to a Generalized Pareto Distribution (GPD).
Values below this threshold are fitted to a gamma (normal) distribution. By default, 'theta' is the 95th
percentile (and 5th percentile for the left tail). Only for |
detrend |
logical. Detrend data prior to bias correction? Only for |
isimip3.args |
Named list of arguments passed to function |
join.members |
Logical indicating whether members should be corrected independently ( |
return.raw |
If TRUE, the nearest raw data to the observational reference is returned as the "var" dimension. (Default to FALSE). |
interpGrid.args |
Optional list fo the arguments passed to interpGrid. Configures the type of interpolation (Default "nearest") performed before bias adjustment. |
parallel |
Logical. Should parallel execution be used? |
max.ncores |
Integer. Upper bound for user-defined number of cores. |
ncores |
Integer number of cores used in parallel computation. Self-selected number of
cores is used when |
The methods available are "eqm"
, "delta"
,
"scaling"
, "pqm"
, "gpqm"
, "loci"
,
"ptr"
(the four latter used only for precipitation),
"variance"
(only for temperature), "dqm"
and "qdm"
.
These are next briefly described:
Delta
This method consists on adding to the observations the mean change signal (delta method). This method is applicable to any kind of variable but it is preferable to avoid it for bounded variables (e.g. precipitation, wind speed, etc.) because values out of the variable range could be obtained (e.g. negative wind speeds...). This method corresponds to case g=1 and f=0 in Amengual et al. 2012.
Scaling
This method consists on scaling the simulation with the difference (additive) or quotient (multiplicative)
between the observed and simulated means in the train period. The additive
or multiplicative
correction is defined by parameter scaling.type
(default is additive
).
The additive version is preferably applicable to unbounded variables (e.g. temperature)
and the multiplicative to variables with a lower bound (e.g. precipitation, because it also preserves the frequency).
eqm
Empirical Quantile Mapping. This is a very extended bias correction method which consists on calibrating the simulated Cumulative Distribution Function (CDF) by adding to the observed quantiles both the mean delta change and the individual delta changes in the corresponding quantiles. This is equivalent to f=g=1 in Amengual et al. 2012. This method is applicable to any kind of variable.
pqm
Parametric Quantile Mapping. It is based on the initial assumption that both observed and simulated intensity distributions are well approximated by a given distribution
(see fitdistr
to check available distributions), therefore is a parametric q-q map that uses the theorical instead of the empirical distribution.
For instance, the gamma distribution is described in Piani et al. 2010 and is applicable to precipitation. Other example is the weibull distribution, which
is applicable to correct wind data (Tie et al. 2014).
gpqm
Generalized Quantile Mapping (described in Gutjahr and Heinemann 2013) is also a parametric quantile mapping (see method 'pqm') but using two teorethical distributions, the gamma distribution and Generalized Pareto Distribution (GPD). By default, It applies a gamma distribution to values under the threshold given by the 95th percentile (following Yang et al. 2010) and a general Pareto distribution (GPD) to values above the threshold. The threshold above which the GPD is fitted is the 95th percentile of the observed and the predicted wet-day distribution, respectively. If precip=FALSE values below the 5th percentile of the observed and the predicted distributions are additionally fitted using GPD and the rest of the values of the distributions are fitted using a normal distribution. The user can specify a different threshold(s) by modifying the parameter theta.
mva
Mean and Variance Adjustment.
variance
Variance scaling of temperature. This method is described in Chen et al. 2011. It is applicable only to temperature. It corrects the mean and variance of temperature time series.
loci
Local intensity scaling of precipitation. This method is described in Schmidli et al. 2006. It adjust the mean as well as both wet-day frequencies and wet-day intensities. The precipitation threshold is calculated such that the number of simulated days exceeding this threshold matches the number of observed days with precipitation larger than 1 mm.
ptr
Power transformation of precipitation. This method is described in Leander and Buishand 2007 and is applicable only to precipitation. It adjusts the variance statistics of precipitation time series in an exponential form. The power parameter is estimated on a monthly basis using a 90-day window centered on the interval. The power is defined by matching the coefficient of variation of corrected daily simulated precipitation with the coefficient of variation of observed daily precipitation. It is calculated by root-finding algorithm using Brent's method.
dqm
Detrended quantile matching with delta-method extrapolation, described in Cannon et al. 2015. It consists on (i) removing the long-term mean (linear) trend; (ii) eqm is applied to the detrended series; (iii) the mean trend is then reapplied to the bias-adjusted series. It preserves the mean change signal in a climate change context. It allows relative (multiplicative) and additive corrections.
qdm
Quantile delta mapping, described in Cannon et al. 2015. It consists on (i) detrending the individual quantiles; (ii) QM is applied to the detrended series; (iii) the projected trends are then reapplied to the bias-adjusted quantiles. It explicitly preserves the change signal in all quantiles. It allows relative (multiplicative) and additive corrections.
isimip3
A calibrated grid of the same spatio-temporal extent than the input "y"
In the case of precipitation a frequency adaptation is performed in all versions of quantile mapping following Themeßl et al. (2012; https://doi.org/10.1007/s10584-011-0224-4), but sampling from the observed Gamma distribution instead of using linear interpolation. This is a preprocess to alleviate the problems arising when the dry day frequency in the raw model output is larger than in the observations. The opposite situation is automatically adjusted by quantile methods.
The precipitation subroutines are switched-on when the variable name of the grid
(i.e., the value returned by gridData$Variable$varName
) is one of the following:
"pr"
, "tp"
(this is the standard name defined in the vocabulary (C4R.vocabulary
), "precipitation"
or "precip"
.
Thus, caution must be taken to ensure that the correct bias correction is being undertaken when dealing with
non-standard variables.
S. Herrera, M. Iturbide, J. Bedia
R.A.I. Wilcke, T. Mendlik and A. Gobiet (2013) Multi-variable error correction of regional climate models. Climatic Change, 120, 871-887
A. Amengual, V. Homar, R. Romero, S. Alonso, and C. Ramis (2012) A Statistical Adjustment of Regional Climate Model Outputs to Local Scales: Application to Platja de Palma, Spain. J. Clim., 25, 939-957
C. Piani, J. O. Haerter and E. Coppola (2009) Statistical bias correction for daily precipitation in regional climate models over Europe, Theoretical and Applied Climatology, 99, 187-192
O. Gutjahr and G. Heinemann (2013) Comparing precipitation bias correction methods for high-resolution regional climate simulations using COSMO-CLM, Theoretical and Applied Climatology, 114, 511-529
M. R. Tye, D. B. Stephenson, G. J. Holland and R. W. Katz (2014) A Weibull Approach for Improving Climate Model Projections of Tropical Cyclone Wind-Speed Distributions, Journal of Climate, 27, 6119-6133
Cannon, A.J., S.R. Sobie, and T.Q. Murdock (2015) Bias Correction of GCM Precipitation by Quantile Mapping: How Well Do Methods Preserve Changes in Quantiles and Extremes?. J. Climate, 28, 6938–6959, https://doi.org/10.1175/JCLI-D-14-00754.1
isimip
for a trend-preserving method of model calibration.
Other downscaling:
glimpr()
,
isimip()
require(climate4R.datasets)
data("EOBS_Iberia_pr")
data("CORDEX_Iberia_pr")
y <- EOBS_Iberia_pr
x <- CORDEX_Iberia_pr
# empirical
eqm1 <- biasCorrection(y = y, x = x,
precipitation = TRUE,
method = "eqm",
window = NULL,
wet.threshold = 0.1,
join.members = TRUE)
eqm1win <- biasCorrection(y = y, x = x,
precipitation = TRUE,
method = "eqm",
extrapolation = "none",
window = c(30, 15),
wet.threshold = 0.1)
eqm1folds <- biasCorrection(y = y, x = x,
precipitation = TRUE,
method = "eqm",
window = c(30, 15),
wet.threshold = 0.1,
cross.val = "kfold",
folds = list(1983:1989, 1990:1996, 1997:2002))
#parametric
pqm1.gamm <- biasCorrection(y = y, x = x,
method = "pqm",
precipitation = TRUE,
fitdistr.args = list(densfun = "gamma"))
pqm1.wei <- biasCorrection(y = y, x = x,
method = "pqm",
precipitation = TRUE,
fitdistr.args = list(densfun = "weibull"))
data("EOBS_Iberia_tas")
data("CORDEX_Iberia_tas")
y <- EOBS_Iberia_tas
x <- CORDEX_Iberia_tas
pqm1.norm <- biasCorrection(y = y, x = x,
method = "pqm",
fitdistr.args = list(densfun = "normal"))
# correction of future climate change data
data("CORDEX_Iberia_tas.rcp85")
newdata <- CORDEX_Iberia_tas.rcp85
eqm1win <- biasCorrection(y = y, x = x,
newdata = newdata,
method = "eqm",
extrapolation = "constant",
window = c(30, 15),
wet.threshold = 0.1)
pqm1.norm <- biasCorrection(y = y, x = x,
newdata = newdata,
method = "pqm",
fitdistr.args = list(densfun = "normal"))
# Correction of multimember datasets considering the joint
# distribution of all members
data("EOBS_Iberia_pr")
data("CFS_Iberia_pr")
y <- EOBS_Iberia_pr
x <- CFS_Iberia_pr
eqm.join <- biasCorrection(y = y, x = x,
precipitation = TRUE,
method = "eqm",
window = NULL,
wet.threshold = 0.1,
join.members = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.