R/ComprehensivePrecipitationGenerator.R
ComprehensivePrecipitationGenerator.RdThe comprehensive Precipitation Generator
ComprehensivePrecipitationGenerator(
station = c("T0001", "T0010", "T0099"),
prec_all,
mean_climate_prec = NULL,
year_max = 1990,
year_min = 1961,
leap = TRUE,
nmonth = 12,
cpf = NULL,
verbose = TRUE,
p = 1,
type = "none",
lag.max = NULL,
ic = "AIC",
activateVARselect = FALSE,
exogen = NULL,
exogen_sim = NULL,
is_exogen_gaussian = FALSE,
year_max_sim = year_max,
year_min_sim = year_min,
mean_climate_prec_sim = NULL,
onlygeneration = FALSE,
varmodel = NULL,
type_quantile = 3,
qnull = NULL,
valmin = 0.5,
step = 0,
n_GPCA_iteration = 0,
n_GPCA_iteration_residuals = n_GPCA_iteration,
sample = NULL,
extremes = TRUE,
exogen_all = NULL,
exogen_all_col = station,
no_spline = FALSE,
nscenario = 1,
seed = NULL,
noise = NULL,
nearPD = FALSE
)character vector of the IDs of the considered meteorological stations
data frame containing daily precipitation of all meteorological stations. See PRECIPITATION defined in the trentino dataset for formatting.
a matrix containing monthly mean daily precipitation for the considered station. If it is NULL, it is calculated. See input of is.monthly.climate
start year of the recorded (calibration) period
end year of the recorded (calibration) period
logical variables. If it is TRUE (default)(recommended), leap years are considered, otherwise all years have 365 days
number of months in one year (default is 12)
logical variable
see respective input parameter on getVARmodel
data frame or matrix containing the (normalized or not) exogenous variables (predictors) for the recorded (calibration) period.
data frame or matrix containing the (normalized or not) exogenous variables (predictors) for the simulation period. Default is NULL. If it is NULL, it is replaced with exogen within the function.
logical value. If TRUE, exogen_sim and exogen are given as already normalized variables, otherwhise they are not normalized. Default is FALSE
last year of the simulation period. Default is equal to year_max
first year of the simulation period. Default is equal to year_min
a matrix containing monthly mean daily precipitation for the simulation period. If is NULL (Default), it is set equal to mean_climate_prec.
logical value. If TRUE the VAR model varmodel is given as input and only random generation is done, otherwise (default) is calculated from measured data
the comprehensinve VAR model as a varest2 S4 object or a NULL object. If NULL (default), the comprehensinve VAR is estimated from measured data within the function, otherwise it is given as input and only random generation is done.
see type on quantile
see normalizeGaussian_severalstations. Default is 0.
number of iterations of Gaussianization process for data. Default is 0 (no Gaussianization)
number of iterations of Gaussianization process for VAR residuals. Default is 0 (no Gaussianization)
data frame containing exogenous variable formatted like prec_all. Default is NULL.
It is alternative to exogen and if it not NULL,is_exogen_gaussian is automatically set FALSE
vector of considered columns of exogen_all. Default is station.
logical value. See splineInterpolateMonthlytoDailyforSeveralYears. Default is TRUE.
number of generated scenarios for daily maximum and minimum temperature
seed for stochastic random generation see set.seed.
stochastic noise to add for variabile generation. Default is NULL. See newVARmultieventRealization. Not used in case that nscenario>1.
logical. Default is FALSE. See getVARmodel.
A list of the following variables:
prec_mes matrix containing measured daily precipitation (the data is copied by the measured data given as input for the period and the station considered for varmodel estimation)
prec_spline matrix containing climatic "spline-interpolated" daily preciptation from mean_climate_prec
data_prec matrix containing normalized measured precipitation variable
prec_gen matrix containing generated daily precipitation [mm]
prec_spline_sim matrix containing climatic "spline-interpolated" daily preciptation from mean_climate_prec_sim
data_prec_gen matrix containing normalized generated precipitation variable
mean_climate_prec matrix containing monthly means of daily precipitation (historical scenario)
mean_climate_prec_sim matrix containing monthly means of daily precipitation (predicted/simulated scenario)
var a varest object containing the used VAR model
It pre-processes and generates a multi-site precipitation fields. It uses getVARmodel. Detailed examples can be viewed of this function in this presentation.
Unfortunately, using this approach, the spatial correlations are underestimated. This is due to the persinstence of zeros in the precipitation records.
This problem is known in literature and can be solved in the future versions of RMAWGEN.
See the R code for further details
data(trentino)
set.seed(1222) # set the seed for random generations!
year_max <- 1990
year_min <- 1961
year_max_sim <- 1982
year_min_sim <- 1981
n_GPCA_iter <- 2
p <- 1
nscenario=1
station <- c("T0090","T0083")
# \donttest{
## Not Run: the call to ComprehensivePrecipitationGenerator may elapse too
## long time (more than 5 eseconds) and is not executed by default CRAN check.
## Please uncomment the following line to run the example on your own PC.
generation00 <- ComprehensivePrecipitationGenerator(station=station,
prec_all=PRECIPITATION,year_min=year_min,year_max=year_max,
year_min_sim=year_min_sim,year_max_sim=year_max_sim,p=p,
n_GPCA_iteration=n_GPCA_iter,n_GPCA_iteration_residuals=0,
sample="monthly",nscenario=nscenario,no_spline=TRUE)
# }