downscale | R Documentation |
Workhorse function to call the different perfect-prog downscaling methods
downscale(
y,
x,
newdata = x,
method = c("analogs", "glm", "lm"),
simulate = c(FALSE, TRUE),
n.analogs = 1,
sel.fun = c("mean", "wmean", "max", "min", "median"),
wet.threshold = 0.1,
n.pcs = NULL,
cross.val = c("none", "loocv", "kfold"),
folds = NULL
)
y |
The observations dataset. It should be an object as returned by loadeR. |
x |
The input grid. It should be an object as returned by loadeR. |
newdata |
It should be an object as returned by loadeR and consistent with x. Default is newdata = x. |
method |
Downscaling method. Options are c = ("analogs","glm","lm"). Glm can only be set when downscaling precipitation. |
simulate |
A logic value indicating whether we want to simulate or not based on the GLM distributional parameters. Only relevant when perdicting with a GLM. Default to FALSE. |
n.analogs |
Applies only when |
sel.fun |
Applies only when |
wet.threshold |
Value below which precipitation amount is considered zero |
n.pcs |
Integer indicating the number of EOFs to be used as predictors |
cross.val |
Should cross-validation be performed? methods available are leave-one-out ( |
folds |
This arguments controls the number of folds, or how these folds are created (ignored if |
Scaling and centering When the climate variables are used as predictors instead of the PCs, these are previously centered and scaled using the mean and sigma parameters globally computed for the whole spatial domain.
The prediction structure.
downscaleTrain for training a downscaling model downscalePredict for prediction for a a test dataset with a trained model for downscaleCV for automatic cross-validation downscaleR Wiki for downscaling seasonal forecasting and climate projections.
Other downscaling.functions:
downscaleCV()
,
downscaleChunk()
,
downscalePredict()
,
downscaleTrain()
require(transformeR)
require(climate4R.datasets)
data("NCEP_Iberia_hus850")
data("NCEP_Iberia_ta850")
x <- makeMultiGrid(NCEP_Iberia_hus850, NCEP_Iberia_ta850)
newdata <- subsetGrid(x, years = 1994:1995)
x <- subsetGrid(x, years = 1985:1993)
# Loading predictands
data("VALUE_Iberia_pr")
y <- VALUE_Iberia_pr
y <- getTemporalIntersection(obs = y,prd = x, "obs" )
x <- getTemporalIntersection(obs = y,prd = x, "prd" )
### Analogs ###
# None
yp <- downscale(y, x, method = "analogs")
yp <- downscale(y, x, newdata, method = "analogs")
# kfold
yp <- downscale(y, x, method = "analogs", n.pcs = 15,
cross.val = "kfold", folds = list(c(1985, 1986, 1987),
c(1988, 1989, 1990),
c(1991, 1992, 1993)))
# Leave-one-year-out
yp <- downscale(y, x, method = "analogs", n.pcs = 15,
cross.val = "loocv")
### GLM ###
# None
yp <- downscale(y, x, method = "glm", simulate = FALSE, n.pcs = 10,
wet.threshold = 1)
yp <- downscale(y, x, method = "glm", simulate = TRUE, n.pcs = 10,
wet.threshold = 1)
# kfold
yp <- downscale(y, x, method = "glm", simulate = FALSE, n.pcs = 10,
cross.val = "kfold", folds = list(c(1985, 1986, 1987),
c(1988, 1989, 1990),
c(1991, 1992, 1993)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.