Skip to contents

Input data for the plot_WalterLieth() 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_WalterLieth() (e.g., for comparing different time periods) without needing to generate the inputs each time.

Usage

plot_WalterLieth_input(
  xyz,
  obs_period = NULL,
  gcms = NULL,
  ssps = NULL,
  gcm_periods = NULL,
  db_option = "auto"
)

Arguments

xyz

a terra::SpatRaster with a single layer containing elevation values in metres, or a data.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().

db_option

character. One of auto, database, or local. Default auto.

vars

character. A vector of climate variables to compute. Supported variables can be obtained with list_vars(). Definitions can be found in this package variables dataset. Default to monthly PPT, Tmax, Tmin.

Value

data.table of average downscaled climate variables for all locations.

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_WalterLieth_input(my_points, db_option = "local")

  # use the input to create a plot
  plot_WalterLieth(my_data)
}
#'