Skip to contents

input_gcms retrieves anomalies of 20-year periods for selected GCMs, SSPs, periods and runs.

input_gcm_hist creates GCM time series inputs for the historical scenario (1850-2014), given chosen GCMs, years and runs.

input_gcm_ssp creates future GCM time series inputs, given chosen GCMs, SSPs, years and runs.

Usage

input_gcms(
  dbCon,
  bbox = NULL,
  gcms = list_gcms(),
  ssps = list_ssps(),
  period = list_gcm_periods(),
  max_run = 0L,
  cache = TRUE
)

input_gcm_hist(
  dbCon,
  bbox = NULL,
  gcms = list_gcms(),
  years = 1901:2014,
  max_run = 0L,
  cache = TRUE
)

input_gcm_ssp(
  dbCon,
  bbox = NULL,
  gcms = list_gcms(),
  ssps = list_ssps(),
  years = 2020:2030,
  max_run = 0L,
  cache = TRUE
)

Arguments

dbCon

A db connection object created by data_connect.

bbox

numeric. Vector of length 4 giving bounding box of study region, in the order ymax,ymin,xmax,xmin. In general this is created by get_bb(), but can also be user-defined.

gcms

character. Vector of labels of the global circulation models to use. Can be obtained from list_gcms(). Default to all GCMs available.

ssps

character. Vector of SSP-RCP scenarios (representative concentration pathways paired with shared socioeconomic pathways). Options are list_ssps(). Defaults to all scenarios available.

period

character. Vector of labels of the periods to use. Can be obtained from list_gcm_periods(). Defaults to all periods available.

max_run

integer. Maximum number of model runs to include. A value of 0 returns the ensembleMean only. Runs are included in the order they are found in the models data until max_run is reached. Defaults to 0L.

cache

logical. Specifying whether to cache new data locally or no. Defaults to TRUE.

years

Numeric or character vector in 2020:2100. Defaults to 2020:2030. See list_gcm_ssp_years() for available years.

Value

A list of SpatRasters, each with possibly multiple layers, that can be used with downscale_core().

A list of SpatRasters, each with possibly multiple layers, that can be used with downscale_core().

A list of SpatRasters, each with possibly multiple layers, that can be used with downscale_core().

Details

This function returns a list with one slot for each requested GCM. Rasters inside the list contain anomalies for all requested SSPs, runs, and periods. In general this function should only be used in combination with downscale_core().

This function returns a list with one slot for each requested GCM. Rasters inside the list contain anomalies for all runs and years. In general this function should only be used in combination with downscale_core().

This function returns a list with one slot for each requested GCM. Rasters inside the list contain anomalies for all SSPs, runs and years. In general this function should only be used in combination with downscale_core(). Note that if you request multiple runs, multiple SSPs, and a lot of years, it will take a while to download the data (there's lot of it).

Examples

library(terra)
xyz <- data.frame(lon = runif(10, -140, -106), lat = runif(10, 37, 61), elev = runif(10), id = 1:10)

## get bounding box based on input points
thebb <- get_bb(xyz)

## get database connection
dbCon <- data_connect()

gcms <- input_gcms(dbCon, thebb, list_gcms()[1], list_ssps()[1])
#> Not fully cached :( Will download more
#> Downloading GCM anomalies
#> .
#> Caching data...

## show ensemble means only
lyrs <- grep("ensemble", names(gcms$`ACCESS-ESM1-5`))

plot(gcms$`ACCESS-ESM1-5`[[lyrs]])

pool::poolClose(dbCon)