Skip to contents

Fetch data and extract a time series at a specific lon/lat location. Handles coordinate transformation from WGS84 to the WRF Lambert Conformal grid automatically.

Usage

cae_fetch_point(
  variable,
  model,
  scenario,
  lon,
  lat,
  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.

lon

numeric; longitude in decimal degrees (WGS84)

lat

numeric; latitude in decimal degrees (WGS84)

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 data.frame with columns: time, value (in native units)

Examples

if (FALSE) { # \dontrun{
# Get hourly temperature at Fresno for one day
ts <- cae_fetch_point("t2", model = "CESM2", scenario = "ssp370",
                     lon = -119.77, lat = 36.75, n_timesteps = 24)
plot(ts$time, ts$value, type = "l")
} # }