dc.argoById: Download and cache an argo file specified by id

Description Usage Arguments See Also Examples

View source: R/argo.R

Description

Download and cache an argo file specified by id

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dc.argoById(
  id = NULL,
  server,
  destdir = ".",
  destfile,
  ntrials = 3,
  force = FALSE,
  dryrun = FALSE,
  quiet = FALSE,
  debug = getOption("dcDebug", 0)
)

Arguments

id

character value giving the Argo float id. In this version of dc.argoById(), the value of id must be a full URL for the netcdf file, and an error is reported if id does not start with ftp://.

server

ignored

destdir

character value indicating the directory in which to store downloaded files. The default value of "." means to store the downloaded file in the present working directory. Set destdir=NULL if destfile is a filename with full path information. File clutter is reduced by creating a top-level directory called data, with subdirectories for various file types; see “Examples”.

destfile

optional character value that specifies the name to be used for the downloaded file. If this is not specified, then a name is determined from the value of id.

ntrials

integer controlling the number of times to attempt to download the file. The default value, ntrials=3, indicates to try a second time if the first one fails, and a third time if the second one fails, but to stop with an error, if all three fail.

force

A logical value that indicates whether to force the download, even if the pathname constructed from destdir and destfile already exists.

dryrun

A logical value that indicates whether to return the constructed web query, without attempting to download the file. This can be helpful in designing responses to changing URLs.

quiet

logical value, passed to curl::curl_download(), that indicates whether to download silently. Since some downloads can be slow, the default value is quiet=FALSE.

debug

an integer specifying whether debugging information is to be printed during processing. The printing is done by a call to dcDebug(). Setting debug=0 turns off this form of debugging, while higher values yield more information. If one dc function calls another, it passes the value of debug but decreased by 1, which means that the value of debug controls not just the breadth of debugging, but also the depth.

See Also

Other functions related to argo data: dc.argoIndex(), dc.argoSearch(), dc.argo()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# These examples assume that the ~/data/argo directory exists and is readable.
## Not run: 
library(oce)
# Case 1: id is a URL; server is ignored.
id <- "ftp://ftp.ifremer.fr/ifremer/argo/dac/nmdis/2901633/profiles/R2901633_071.nc"
f <- dc.argoById(id, destdir="~/data/argo")
a <- read.oce(f)
summary(a) # an oce object of class 'argo'
par(mfrow=c(2, 2))
plot(a, which="map")
mtext(a[["time"]], cex=par("cex"))
mtext(gsub(".*/", "", f), cex=par("cex"), line=-1)
plot(a, which="TS")
plot(a, which="temperature profile")
plot(a, which="salinity profile")

## End(Not run)

dankelley/dc documentation built on June 3, 2020, 8:25 a.m.