General function for downloading and caching a dataset.
downloadWithRetries(
url,
destdir,
destfile,
quiet = FALSE,
age = argoDefaultProfileAge(),
retries = 3,
async = FALSE,
debug = 0
)
character value giving the full URL of a file to be downloaded.
character value indicating the directory in which to store
downloaded files. The default value is to compute this using
argoDefaultDestdir()
, which returns ~/data/argo
by default,
although it also provides ways to set other values using
options()
.
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”.
either character value indicating the name of the file
or NULL
(the default), in which case the file name is constructed from
the other parameters of the function call, so that subsequent calls with
the same parameters will yield the same result; this is useful
for caching.
logical value; use FALSE
to show more
verbose information when downloading files.
(Even if quiet
is TRUE, problems will still be reported.)
a numerical value indicating a time interval, in days. If the file
to be downloaded from the server already exists locally, and was created
is less than age
days in the past, it will not be downloaded. The default,
argoDefaultProfileAge()
, is one year. Setting age=0
will force a download.
integer telling how many times to retry a download, if the first attempt fails.
Use TRUE
to perform requests asynchronously. This is much
faster for many small files (e.g., Argo profile NetCDF files).
integer value indicating level of debugging. If this
is less than 1, no debugging is done. Otherwise, some functions
will print debugging information. If a function call fails, the
first step should be to rerun the function with debug=1
,
to see if the output suggests a problem in the call.
A character value indicating the full pathname to the downloaded file,
or NA
, if there was a problem with the download.