View source: R/createExpSpace.R
createExpSpace | R Documentation |
createExpSpace
returns a list containing the targets (targetMat
) and the metadata (input arguments) used to create the exposure space.
createExpSpace(
attPerturb,
attPerturbSamp,
attPerturbMin,
attPerturbMax,
attPerturbType = "regGrid",
attPerturbBy = NULL,
attHold = NULL,
attTargetsFile = NULL
)
attPerturb |
A char vector; the names of the attributes to be perturbed. This vector can contain attributes of different hydroclimatic variables. |
attPerturbSamp |
An integer vector; the number of samples for each attribute |
attPerturbMin |
A numeric vector; the minimum bounds for sampling of |
attPerturbMax |
A numeric vector; the maximum bounds for sampling of |
attPerturbType |
A string to specify the type of sampling, defaults to regular spacing. Valid sampling types are:
|
attPerturbBy |
A numeric vector; increment of values to create samples between |
attHold |
A char vector; the names of the attributes to be held at historical levels. This vector can contain attributes of different hydroclimatic variables. |
attTargetsFile |
String specifying the full path to a CSV file containing the target exposure space.
The column names in the file should correspond to the attributes specified in |
See "Detailed Tutorial: Climate 'Stress-Testing' using *fore*SIGHT" vignette for specifying attribute names for attPerturb
and attHold
. The definition of the attribute can be viewed using the function viewAttributeDef
.
The exposure space as a list containing the following fields:
targetMat
a dataframe or matrix; each column is a perturb/hold attribute, each row is a point in the exposure space.
attRot
a char vector containing the one-at-a-time ("OAT") attributes associated with targetMat
, attRot
is NULL
for other types of sampling.
attPerturb
, attHold
, attPerturbSamp
, attPerturbMin
, attPerturbMax
, attPerturbType
in the function input arguments, if not NULL
.
generateScenarios
, viewAttributeDef
# To view the definition of any valid attribute
viewAttributeDef("P_ann_tot_m")
# To create an exposure space of points on a regular grid
attPerturb <- c("P_ann_tot_m", "P_ann_nWet_m", "P_ann_R10_m")
attPerturbType <- "regGrid"
attPerturbSamp <- c(3, 1, 1)
attPerturbMin <- c(0.9, 1, 1)
attPerturbMax <- c(1.1, 1, 1)
attHold <- c("P_Feb_tot_m", "P_SON_dyWet_m", "P_JJA_avgWSD_m",
"P_MAM_tot_m", "P_DJF_avgDSD_m", "Temp_ann_rng_m", "Temp_ann_avg_m")
expSpace <- createExpSpace(attPerturb = attPerturb, attPerturbSamp = attPerturbSamp,
attPerturbMin = attPerturbMin, attPerturbMax = attPerturbMax,
attPerturbType = attPerturbType, attHold = attHold, attTargetsFile = NULL)
# Using attPerturbBy to specify the increment of perturbation (attPerturbSamp set to NULL)
attPerturb <- c("P_ann_tot_m", "P_ann_nWet_m", "P_ann_R10_m")
attPerturbType <- "regGrid"
attPerturbMin <- c(0.9, 1, 1)
attPerturbMax <- c(1.1, 1, 1)
attPerturbBy <- c(0.1, 0, 0)
attHold <- c("P_Feb_tot_m", "P_SON_dyWet_m", "P_JJA_avgWSD_m", "P_MAM_tot_m",
"P_DJF_avgDSD_m", "Temp_ann_rng_m", "Temp_ann_avg_m")
expSpace <- createExpSpace(attPerturb = attPerturb, attPerturbSamp = NULL,
attPerturbMin = attPerturbMin, attPerturbMax = attPerturbMax, attPerturbType = attPerturbType,
attPerturbBy = attPerturbBy, attHold = attHold, attTargetsFile = NULL)
# To create an exposure space of observed attributes without perturbation
# Note that attPerturbMin and attPerturbMax values are set to 1 for variables like precipitation,
# and 0 for temperature
attPerturb <- c("P_ann_tot_m", "P_ann_nWet_m", "P_ann_R10_m", "Temp_DJF_avg_m")
attPerturbType <- "regGrid"
attPerturbSamp <- c(1, 1, 1, 1)
attPerturbMin <- c(1, 1, 1, 0)
attPerturbMax <- c(1, 1, 1, 0)
expSpace <- createExpSpace(attPerturb = attPerturb, attPerturbSamp = attPerturbSamp,
attPerturbMin = attPerturbMin, attPerturbMax = attPerturbMax, attPerturbType = attPerturbType,
attHold = NULL, attTargetsFile = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.