Download select GridMET datasets.

mco_get_gridmet(
  x = mt_state %>% sf::st_buffer(10000),
  elements = c("precipitation_amount", "daily_minimum_temperature",
    "daily_maximum_temperature"),
  dates = "latest",
  out_dir = tempdir(),
  overwrite = TRUE,
  ...
)

Arguments

x

An object of class sf.

elements

Gridmet variables to download.

dates

An object of class Date or a character string formatted as %Y-%m-%d (e.g., "2016-04-01") which specifies the date(s) to search. To search for one specific date, this can be a Date object of length one. To return data over a time interval, it can be a vector of length 2 (e.g., c("2018-01-01","2018-03-31")). Use "latest" (the default) to retreive the most recent date available product.

out_dir

A directory in which to download the raw MACA V2 datasets. Defaults to the current working directory

overwrite

Whether to overwrite a file in the out_dir of the same element.

...

Other parameters passed on to thredds::tds_ncss_download.

Value

A raster brick of the desired MACA V2 datasets.

Examples

if (FALSE) { test <- mco_get_gridmet() test <- mco_get_gridmet(dates = "2018-02-14") test <- mco_get_gridmet(dates = "2018-03-31") test <- mco_get_gridmet(dates = c("2018-01-01","2018-04-01")) }