Learn R Programming

foreSIGHT (version 0.9.81)

scenarioGenerator: Scenario Generator

Description

Produces the data needed for an exposure space of requested climate variables, attributes and bounds.

Usage

scenarioGenerator(obs = NULL,
                  modelTag = NULL,
                  modelInfoMod=list(),
                  attPerturb = NULL,
                  attHold=NULL,
                  attPenalty = NULL,
                  optimArgs = list(pcrossover= 0.8,
                                pmutation=0.1,
                                maxiter=10,
                                maxFitness=-0.001,
                                popSize = 100,
                                run=20,
                                seed = 1234,
                                parallel = FALSE,
                                keepBest=TRUE,
                                lambda.mult = 0,
                                suggestions=NULL
                                ),
                  exSpArgs=list(),
                  simLengthNyrs=NULL,
                  IOmode="suppress",
                  arrayID=NULL,
                  nSeed=NULL,
                  seedID=1234,
                  simDirectory="Simulation1"
                  )

Arguments

obs

A dataframe of observed climate data in the form Year Month Day P Temp.

modelTag

A character vector of which stochastic models to use to create each climate variable.Supported tags are shown under details below.

modelInfoMod

A list containing information for modifying stochastic model bounds and defining fixed parameters.

attPerturb

A character vector of climate attributes to hold at a target. A list of all supported attributes can be found under shown under details below.

attHold

A character vector of climate attributes to hold at a target. A list of all supported attributes can be found under shown under details below.

attPenalty

A character vector of climate attributes to place specific focus on during targeting via the use of a penalty function during the optimisation process.

optimArgs

A list controlling the search algorithm with the following components:

pcrossover

a value of probability of crossover. Defaults to 0.8.

pmutation

a value of probability of mutation. Defaults to 0.1

maxiter

a value of the maximum number of generations. Defaults to 50

maxFitness

a value of the stopping criteria. Defaults to 0.001

popSize

a value of the population size. Defaults to 100

run

a value of an alternative stopping criteria - consecutive runs without improvement in fitness. Defaults to 0.001

seed

a value of the random seed. Defaults to 1234.

parallel

specifies if parallel computing should be used. Defaults to False. Can be set to the number of desired cores, or TRUE, where it will detect the number of available cores and run.

keepBest

specifies if the optimisation should keep the best solution in each generation. Defaults to TRUE.

lambda.mult

A multiplier used during the optimisation for primary attributes. Defaults to zero.

exSpArgs

a list to control the exposure space creation with the following components:

type

a string that specifies the type of sampling. Defaults to regular spacing.

samp

a vector indicating the number of targets for each attribute in attSel.

bounds

a list containing elements for attributes listed in attSel, where each attribute has bounds specified. This should be a single value for a stationary target, and a vector of min and max change for primary attributes. Works with samp to create number of step sizes. Defaults with samp to only reproduce historical weather.

simLengthNyrs

A scalar that specifies the length in years of each generated scenario. Only used with stochastic generation.

IOmode

A string that specifies the input-output mode for the scenarios = "verbose", "dev" or "suppress".

arrayID

A scalar used to append output file names - only used in IOmode="dev".

nSeed

A scalar used to specify the number of seeds (in this case replicates) for the stochastic generation of time series.

seedID

determines how seeds are used - option "fixed","arrayID" or a number to set the seed.

simDirectory

A string used to label the output directory.

Details

modelTag provides the main function with requested models. modelTag is vector of any of the following supported models:

  • "Simple-ann"a simple annual scaling

  • "P-ann-wgen"a four parameter annual rainfall model

  • "P-seas-wgen"a 16 parameter seasonal rainfall model

  • "P-har6-wgen"a harmonic rainfall model with 6 periods

  • "P-har12-wgen"a harmonic rainfall model

  • "P-har12-wgen-FS"a harmonic rainfall model where seasonality is fixed (phase angles must be specified via modelInfoMod=list("P-har12-wgen-FS"=fixedPars=c(x,x,x,x))

  • "P-har26-wgen"a harmonic rainfall model

  • "P-2har26-wgen"a double harmonic rainfall model

  • "Temp-har26-wgen"a harmonic temperature model not conditional on rainfall

  • "Temp-har26-wgen-wd"a harmonic temperature model dependent on wet or dry day

  • "Temp-har26-wgen-wdsd"a harmonic temperature model where standard deviation parameters are dependent on wet or dry day

  • "PET-har12-wgen"a harmonic potential evapotranspiration model

  • "PET-har26-wgen"a harmonic potential evapotranspiration model

  • "PET-har26-wgen-wd"a harmonic potential evapotranspiration model dependent on wet or dry day

  • "Radn-har26-wgen"a harmonic solar radiation model (MJ/m2)

The list of attributes supported by attSel are:

  • "P_ann_tot_m"

  • "P_ann_R10_m"

  • "P_ann_maxDSD_m"

  • "P_ann_maxWSD_m"

  • "P_ann_P99_m"

  • "P_ann_dyWet99p_m"

  • "P_ann_ratioWS_m"

  • "Temp_ann_avg_m"

  • "Temp_ann_P5_m"

  • "Temp_ann_P95_m"

  • "Temp_ann_F0_m"

  • "P_ann_dyWet_m"

  • "P_ann_DSD_m"

  • "P_seas_tot_cv"

  • "P_mon_tot_cv"

  • "P_ann_avgWSD_m"

  • "P_ann_avgDSD_m"

  • "P_JJA_avgWSD_m"

  • "P_MAM_avgWSD_m"

  • "P_DJF_avgWSD_m"

  • "P_SON_avgWSD_m"

  • "P_JJA_avgDSD_m"

  • "P_MAM_avgDSD_m"

  • "P_DJF_avgDSD_m"

  • "P_SON_avgDSD_m"

  • "Temp_ann_GSL_m"

  • "Temp_ann_CSL_m"

  • "P_JJA_dyWet_m"

  • "P_MAM_dyWet_m"

  • "P_DJF_dyWet_m"

  • "P_SON_dyWet_m"

  • "P_JJA_tot_m"

  • "P_MAM_tot_m"

  • "P_DJF_tot_m"

  • "P_SON_tot_m"

  • "P_ann_nWet_m"

  • "P_ann_dyAll_m"

  • "P_JJA_dyAll_m"

  • "P_MAM_dyAll_m"

  • "P_DJF_dyAll_m"

  • "P_SON_dyAll_m"

  • "PET_ann_avg_m"

  • "PET_ann_tot_m"

  • "PET_ann_rng_m"

  • "Temp_ann_rng_m"

  • "PET_ann_90pX_m"

  • "P_ann_90X_m"

  • "P_ann_seasRatio_m"

  • "PET_ann_P5_m"

  • "PET_ann_P95_m"

  • "P_Jan_tot_m"

  • "P_Feb_tot_m"

  • "P_Mar_tot_m"

  • "P_Apr_tot_m"

  • "P_May_tot_m"

  • "P_Jun_tot_m"

  • "P_Jul_tot_m"

  • "P_Aug_tot_m"

  • "P_Sep_tot_m"

  • "P_Oct_tot_m"

  • "P_Nov_tot_m"

  • "P_Dec_tot_m"

  • "Temp_JJA_avg_m"

  • "Temp_MAM_avg_m"

  • "Temp_DJF_avg_m"

  • "Temp_SON_avg_m"

  • "Temp_Jan_avg_m"

  • "Temp_Feb_avg_m"

  • "Temp_Mar_avg_m"

  • "Temp_Apr_avg_m"

  • "Temp_May_avg_m"

  • "Temp_Jun_avg_m"

  • "Temp_Jul_avg_m"

  • "Temp_Aug_avg_m"

  • "Temp_Sep_avg_m"

  • "Temp_Oct_avg_m"

  • "Temp_Nov_avg_m"

  • "Temp_Dec_avg_m"

  • "PET_JJA_avg_m"

  • "PET_MAM_avg_m"

  • "PET_DJF_avg_m"

  • "PET_SON_avg_m"

  • "PET_JJA_tot_m"

  • "PET_MAM_tot_m"

  • "PET_DJF_tot_m"

  • "PET_SON_tot_m"

  • "PET_Jan_tot_m"

  • "PET_Feb_tot_m"

  • "PET_Mar_tot_m"

  • "PET_Apr_tot_m"

  • "PET_May_tot_m"

  • "PET_Jun_tot_m"

  • "PET_Jul_tot_m"

  • "PET_Aug_tot_m"

  • "PET_Sep_tot_m"

  • "PET_Oct_tot_m"

  • "PET_Nov_tot_m"

  • "PET_Dec_tot_m"

  • "PET_Jan_avg_m"

  • "PET_Feb_avg_m"

  • "PET_Mar_avg_m"

  • "PET_Apr_avg_m"

  • "PET_May_avg_m"

  • "PET_Jun_avg_m"

  • "PET_Jul_avg_m"

  • "PET_Aug_avg_m"

  • "PET_Sep_avg_m"

  • "PET_Oct_avg_m"

  • "PET_Nov_avg_m"

  • "PET_Dec_avg_m"

  • "PET_ann_seasRatio_m"

  • "Radn_ann_avg_m"

  • "Radn_ann_tot_m"

  • "Radn_ann_rng_m"

  • "Radn_ann_P5_m"

  • "Radn_ann_P95_m"

  • "Radn_JJA_avg_m"

  • "Radn_MAM_avg_m"

  • "Radn_DJF_avg_m"

  • "Radn_SON_avg_m"

  • "Radn_JJA_tot_m"

  • "Radn_MAM_tot_m"

  • "Radn_DJF_tot_m"

  • "Radn_SON_tot_m"

  • "Radn_Jan_tot_m"

  • "Radn_Feb_tot_m"

  • "Radn_Mar_tot_m"

  • "Radn_Apr_tot_m"

  • "Radn_May_tot_m"

  • "Radn_Jun_tot_m"

  • "Radn_Jul_tot_m"

  • "Radn_Aug_tot_m"

  • "Radn_Sep_tot_m"

  • "Radn_Oct_tot_m"

  • "Radn_Nov_tot_m"

  • "Radn_Dec_tot_m"

  • "Radn_Jan_avg_m"

  • "Radn_Feb_avg_m"

  • "Radn_Mar_avg_m"

  • "Radn_Apr_avg_m"

  • "Radn_May_avg_m"

  • "Radn_Jun_avg_m"

  • "Radn_Jul_avg_m"

  • "Radn_Aug_avg_m"

  • "Radn_Sep_avg_m"

  • "Radn_Oct_avg_m"

  • "Radn_Nov_avg_m"

  • "Radn_Dec_avg_m"

  • "Radn_ann_seasRatio_m"

Examples

Run this code
# NOT RUN {
library(foreSIGHT)                 ###Load package

data(tankDat)                         ###Load tank data

###Scenario generation arguments
modelTag="Simple-ann"
attPerturb<-c("P_ann_tot_m","Temp_ann_avg_m")
exSpArgs<-list(type = "regGrid",
               samp = c(7,6),
               bounds = list("P_ann_tot_m"=c(0.9,1.5),
                             "Temp_ann_avg_m"=c(-1,4)))

###Function call
out<-scenarioGenerator(obs=tank_obs,
                  modelTag = modelTag,
                  attPerturb=attPerturb,
                  exSpArgs = exSpArgs,
                  simDirectory="Simulation1")


# }

Run the code above in your browser using DataLab