tds_ncss_download: Download a THREDDS dataset via a NetcdfSubset service

Description Usage Arguments Value Examples

Description

Download a THREDDS dataset via a NetcdfSubset service

Usage

1
2
tds_ncss_download(ncss_url, out_file, bbox, vars = NULL, ncss_args = NULL,
  overwrite = TRUE, ...)

Arguments

ncss_url

The url of a THREDDS NetcdfSubset service, perhaps retrieved using tds_list_services.

out_file

A file in which to download the dataset.

bbox

An optional object of class 'bbox' from which to construct a bounding box. Must be in EPSG:4326. Defaults to NULL, which will download the entire NetCDF dataset.

vars

A character vector of variable names, perhaps retrieved using tds_ncss_list_vars. Defaults to all available variables.

ncss_args

A named list of additional NetcdfSubset arguments for the URL.

overwrite

A logical; whether to overwrite the downloaded file if it exists. Defaults to 'TRUE'.

...

Other arguments passed on to httr::GET().

Value

The path to the downloaded dataset.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(thredds)
  out.dir <- tempfile()
  dir.create(out.dir,
    showWarnings = FALSE,
    recursive = TRUE)

ncss <- "https://cida.usgs.gov/thredds/ncss/macav2metdata_monthly_historical/dataset.html"
tds_ncss_download(ncss_url = ncss,
                  bbox = sf::st_bbox(c(xmin = -116, xmax = -115, ymin = 44, ymax = 45)),
                  vars = c("huss_BNU-ESM_r1i1p1_historical","huss_CCSM4_r6i1p1_historical"),
                  out_file = paste0(out.dir,"/macav2metdata_monthly_historical.nc"))

mt-climate-office/thredds documentation built on May 25, 2019, 10:34 p.m.