Skip to contents

This function allows users to efficiently pre-cache data for a specific study region, meaning you then don't have to wait for data to download during analysis. Currently, the function only supports caching of reference maps, and future gcm periods.

Usage

pre_cache(
  region = c("BC", "WNA", "NA"),
  bbox = NULL,
  gcms = NULL,
  ssps = NULL,
  gcm_periods = NULL,
  max_run = 0
)

Arguments

region

character. Preset region; options are one of "BC", "WNA", and "NA"

bbox

optional custom bounding box (or SpatExtent) for region of interest. If bbox is specified, region will be ignored.

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.

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.

Details

Since the reference climatologies are stored at a high resolution, downloading a large region from the database can be slow due to the tile stitching required. Thus, to speed up this portion, we built an API on the database server which clips a full GeoTiff using gdalwarp. This allows the download to happen all at once instead of by tiles, and is substantially faster. Since GCM anomalies are at a much lower resolution, downloading them from the database is sufficiently fast.