The 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
)

Arguments

station

character vector of the IDs of the considered meteorological stations

prec_all

data frame containing daily precipitation of all meteorological stations. See PRECIPITATION defined in the trentino dataset for formatting.

mean_climate_prec

a matrix containing monthly mean daily precipitation for the considered station. If it is NULL, it is calculated. See input of is.monthly.climate

year_max

start year of the recorded (calibration) period

year_min

end year of the recorded (calibration) period

leap

logical variables. If it is TRUE (default)(recommended), leap years are considered, otherwise all years have 365 days

nmonth

number of months in one year (default is 12)

cpf

see normalizeGaussian_severalstations

verbose

logical variable

p, type, lag.max, ic, activateVARselect

see respective input parameter on getVARmodel

exogen

data frame or matrix containing the (normalized or not) exogenous variables (predictors) for the recorded (calibration) period.

exogen_sim

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.

is_exogen_gaussian

logical value. If TRUE, exogen_sim and exogen are given as already normalized variables, otherwhise they are not normalized. Default is FALSE

year_max_sim

last year of the simulation period. Default is equal to year_max

year_min_sim

first year of the simulation period. Default is equal to year_min

mean_climate_prec_sim

a matrix containing monthly mean daily precipitation for the simulation period. If is NULL (Default), it is set equal to mean_climate_prec.

onlygeneration

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

varmodel

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.

type_quantile

see type on quantile

step

see normalizeGaussian_severalstations. Default is 0.

n_GPCA_iteration

number of iterations of Gaussianization process for data. Default is 0 (no Gaussianization)

n_GPCA_iteration_residuals

number of iterations of Gaussianization process for VAR residuals. Default is 0 (no Gaussianization)

sample, extremes, qnull, valmin

see normalizeGaussian_severalstations

exogen_all

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

exogen_all_col

vector of considered columns of exogen_all. Default is station.

no_spline

logical value. See splineInterpolateMonthlytoDailyforSeveralYears. Default is TRUE.

nscenario

number of generated scenarios for daily maximum and minimum temperature

seed

seed for stochastic random generation see set.seed.

noise

stochastic noise to add for variabile generation. Default is NULL. See newVARmultieventRealization. Not used in case that nscenario>1.

Value

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

Note

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

Author

Emanuele Cordano, Emanuele Eccel

Examples


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)

# }