Input data for the bivariate climate change plot
plot_bivariate_input.Rd
Input data for the plot_bivariate()
function. Since these inputs are time-consuming to
generate, the purpose of conducting the generation of the input table in a separate function is
to allow users to make multiple calls to plot_bivariate()
(e.g., for comparing different
climate variables) without needing to generate the inputs each time.
Usage
plot_bivariate_input(
xyz,
obs_period = list_obs_periods()[1],
gcms = list_gcms()[c(1, 4, 5, 6, 7, 10, 11, 12)],
ssps = list_ssps()[2],
gcm_periods = list_gcm_periods(),
max_run = 10,
vars = list_vars(),
db_option = "auto"
)
Arguments
- xyz
a
terra::SpatRaster
with a single layer containing elevation values in metres, or adata.frame
with the following columns "long", "lat", "elev", and a unique "id". Any extra columns will be ignored and not output.- gcms
character. Vector of global climate model names. Options are
list_gcms()
.- ssps
character. Vector of SSP-RCP scenarios (representative concentration pathways paired with shared socioeconomic pathways). Options are
list_ssps()
. Defaults to all scenarios available.- gcm_periods
character. 20-year reference periods for GCM simulations. Options are
list_gcm_periods()
.- max_run
integer. Maximum number of model runs to include, not including the ensemble mean. Runs are included in the order they are found in the models data until
max_run
is reached. Defaults to 0L.- vars
character. A vector of climate variables to compute. Supported variables can be obtained with
list_vars()
. Definitions can be found in this packagevariables
dataset. Default to monthly PPT, Tmax, Tmin.- db_option
character. One of
auto
,database
, orlocal
. Defaultauto
.
Details
This function generates standardized inputs for one or multiple locations at any spatial scale.
Examples
if (FALSE) {
# data frame of arbitrary points
my_points <- data.frame(
lon = c(-127.7300, -127.7500),
lat = c(55.34114, 55.25),
elev = c(711, 500),
id = 1:2
)
# generate the input data
my_data <- plot_bivariate_input(my_points)
# use the input to create a plot
plot_bivariate(my_data, xvar = "MAT", yvar = "PAS_an")
}
#'