thredds_download | R Documentation |
This function is used to download FVCOM outputs from the SAMS thredds server.
thredds_download( file_name, pattern = ".nc", server_catalog, dest_file, verbose = TRUE, prompt = FALSE, ... )
file_name |
A character vector of file name(s) which specify the files to be downloaded. These should contain a unique identifier for each file (for example, a date_name, see |
pattern |
A character string containing a regular expression which is matched to identify files (e.g., |
server_catalog |
A character that defines the URL of the catalog. |
dest_file |
A character that defines the directory in which to save file(s). |
verbose |
A logical input that defines whether or not to print messages to the console. These can be useful for monitoring progress. |
prompt |
A logical input that defines whether or not to prompt the user before each download. |
... |
Additional arguments passed to |
To download files, the function first identifies all files on server_catalog
that match pattern
. For each inputted file_name
, the function identifies the full file name and the necessary URL to download that file from the server (a different URL from the catalog) and then downloads the file. If any files cannot be downloaded, the function will print an error message but continue to attempt to download the next file, until there are no remaining files. Note the following: (a) the function is only designed to query a single catalog at a time (i.e., is not recursive, so it will not identify all files on a thredds server, only the specific files in server_catalog
; (b) files are large (usually ~ 700 Mb) and are downloaded in sequence; and (c) the function requires the xml2 and rvest package to be installed.
The function downloads specified files from the SAMS thredds server (https://thredds.sams.ac.uk/thredds/) where WeStCOMS outputs are located.
Edward Lavender
## Not run: # Warning: if you run this code, it may take a long time to download the file # ... which is nearly 1 Gb in size! thredds_download(file_name = "20190702", pattern = ".nc", server = paste0("https://thredds.sams.ac.uk/thredds/", "catalog/scoats-westcoms1/Archive/", "netcdf_2019/catalog.html"), dest_file = tempdir(), verbose = TRUE, prompt = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.