Skip to contents

Read climate data from the Cal-Adapt Analytics Engine Zarr stores on AWS S3. Returns a stars object with the requested variable, optionally clipped to a spatial extent and/or time window.

Usage

cae_fetch(
  variable,
  model,
  scenario,
  timescale = "1hr",
  resolution = "d01",
  start_time = NULL,
  end_time = NULL,
  n_timesteps = NULL
)

Arguments

variable

character; variable name (e.g. "t2", "prec", "psfc"). Use cae_variables() to see what's available.

model

character; GCM name (e.g. "CESM2", "MPI-ESM1-2-HR"). Use cae_models() to see options.

scenario

character; SSP experiment (e.g. "ssp370", "ssp245", "historical"). Use cae_scenarios() to see options.

timescale

character; temporal resolution. One of "1hr", "day", "mon". Default "1hr".

resolution

character; spatial grid. One of "d01" (45km), "d02" (9km), "d03" (3km). Default "d01".

start_time

POSIXct or character; start of time window. If character, parsed as UTC. Default NULL reads from the beginning.

end_time

POSIXct or character; end of time window. Default NULL reads to the end.

n_timesteps

integer; number of timesteps to read. Alternative to end_time for quick reads. Default NULL.

Value

A stars object with the requested data.

Examples

if (FALSE) { # \dontrun{
# Read 24 hours of temperature data at 45km
t2 <- cae_fetch("t2", model = "CESM2", scenario = "ssp370",
               n_timesteps = 24)

# Read a month of daily precipitation from LOCA2
pr <- cae_fetch("pr", model = "EC-Earth3", scenario = "ssp370",
               timescale = "day", resolution = "d03",
               start_time = "2050-01-01", end_time = "2050-01-31")
} # }