The Comprehensive Temperature Generator

ComprehensiveTemperatureGenerator(
  station = c("T0001", "T0010", "T0099"),
  Tx_all,
  Tn_all,
  mean_climate_Tn = NULL,
  mean_climate_Tx = NULL,
  Tx_spline = NULL,
  Tn_spline = NULL,
  year_max = 1990,
  year_min = 1961,
  leap = TRUE,
  nmonth = 12,
  verbose = TRUE,
  p = 1,
  type = "none",
  lag.max = NULL,
  ic = "AIC",
  activateVARselect = FALSE,
  year_max_sim = year_max,
  year_min_sim = year_min,
  mean_climate_Tn_sim = NULL,
  mean_climate_Tx_sim = NULL,
  Tn_spline_sim = NULL,
  Tx_spline_sim = NULL,
  onlygeneration = FALSE,
  varmodel = NULL,
  normalize = TRUE,
  type_quantile = 3,
  sample = NULL,
  extremes = TRUE,
  option = 2,
  yearly = FALSE,
  yearly_sim = yearly,
  n_GPCA_iteration = 0,
  n_GPCA_iteration_residuals = n_GPCA_iteration,
  exogen = NULL,
  exogen_sim = exogen,
  is_exogen_gaussian = FALSE,
  exogen_all = NULL,
  exogen_all_col = station,
  nscenario = 1,
  seed = NULL,
  noise = NULL
)

Arguments

station

see respective input parameter on setComprehensiveTemperatureGeneratorParameters

Tx_all, Tn_all, mean_climate_Tn, mean_climate_Tx, Tx_spline, Tn_spline

see respective input parameter on setComprehensiveTemperatureGeneratorParameters

year_max, year_min, leap, nmonth, verbose

see respective input parameter on setComprehensiveTemperatureGeneratorParameters

p, type, lag.max, ic, activateVARselect

see respective input parameter on getVARmodel

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_Tn_sim

monthly averaged daily minimum temperatures for the simulated scenario and used by the random generator . Default is mean_climate_Tn

mean_climate_Tx_sim

monthly averaged daily maximum temperatures for the simulated scenario and used by the random generator . Default is mean_climate_Tx

Tn_spline_sim

daily timeseries (from the first day of year_min_sim to the last day of year_max_sim) of averaged minimum temperature which can be obtained by a spline interpolation of monthly mean values (for the generation period). Default is Tn_spline. See for spline interpolation utilized splineInterpolateMonthlytoDailyforSeveralYears.

Tx_spline_sim

daily timeseries (from the first day of year_min_sim to the last day of year_max_sim) of averaged maximum temperature which can be obtained by a spline interpolation of monthly mean values (for the generation period). Default is Tx_spline. See for spline interpolation utilized splineInterpolateMonthlytoDailyforSeveralYears.

onlygeneration

logical variable. 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 or GPCAvarest2 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.

normalize, sample, extremes

see normalizeGaussian_severalstations or setComprehensiveTemperatureGeneratorParameters

type_quantile

see type on quantile

option

integer value. If 1, the generator works with minimun and maximum temperature, if 2 (default) it works with the average value between maximum and minimum temparature and the respective daily thermal range.

yearly

logical value. If TRUE the monthly mean values are calculated for each year from year_min to year_max separately. Default is FALSE.

yearly_sim

logical value. If TRUE the monthly mean values are calculated for each year from year_min_sim to year_max_sim separately. Default is yearly.

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)

exogen

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

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, exogen_sim is set equal to 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

exogen_all

data frame containing exogenous variable formatted like Tx_all and Tn_all. Default is NULL. It is alternative to exogen and if it not NULL,is_exogen_gaussian is automatically set to FALSE

exogen_all_col

vector of considered columns of exogen_all. Default is station.

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:

input list of variables returned by setComprehensiveTemperatureGeneratorParameters

var varest object containing the used VAR model (if useVAR is true), NULL (otherwise)

output list variables returned by generateTemperatureTimeseries (i.e. generated timeseries)

Note

It pre-processes series and generates multi-site temperature fields by using setComprehensiveTemperatureGeneratorParameters,getVARmodel and generateTemperatureTimeseries. Detailed examples can be viewed of this function in this presentation.

Author

Emanuele Cordano, Emanuele Eccel

Examples


data(trentino)

set.seed(1222) # set the seed for random generations!
year_min <- 1961
year_max <- 1990

year_min_sim <- 1982
year_max_sim <- 1983

n_GPCA_iter <- 5
n_GPCA_iteration_residuals <- 5
p <- 1
vstation <- c("B2440","B6130","B8570","B9100","LAVIO","POLSA","SMICH","T0001",
 "T0010","T0014","T0018","T0032","T0064","T0083","T0090","T0092",
"T0094","T0099","T0102","T0110","T0129","T0139","T0147","T0149",
"T0152","T0157","T0168","T0179","T0189","T0193","T0204","T0210",
"T0211","T0327","T0367","T0373")
## Not Run: the call to ComprehensiveTemperatureGenerator may elapse
## too long time (more than 5 eseconds) and is not executed  by CRAN check.
## Please uncomment the following line to run the example on your own PC.
# generation00 <-ComprehensiveTemperatureGenerator(station=vstation[16],
# Tx_all=TEMPERATURE_MAX,Tn_all=TEMPERATURE_MIN,year_min=year_min,year_max=year_max,
# p=p,n_GPCA_iteration=n_GPCA_iter,n_GPCA_iteration_residuals=n_GPCA_iteration_residuals,
# sample="monthly",year_min_sim=year_min_sim,year_max_sim=year_max_sim)