download assets from earthdata over https using bearer tokens
Source:R/edl_download.R
edl_download.Rd
NOTE: This should be used primarily as a fallback mechanism! EarthData Cloud resources are often best accessed directly over HTTPS without download. This allows subsets to be extracted instead of downloading unnecessary bits. Unfortunately, certain formats do not support such HTTP-based range requests (e.g. HDF4), and require the asset is downloaded to a local POSIX filesystem first.
Usage
edl_download(
href,
dest = basename(href),
auth = "netrc",
method = "httr",
username = default("user"),
password = default("password"),
netrc_path = edl_netrc_path(),
cookie_path = edl_cookie_path(),
quiet = TRUE,
...
)
Arguments
- href
the https URL of the asset
- dest
local destination
- auth
the authentication method ("token" for Bearer tokens or "netrc" for netrc.)
- method
The download method, either "httr" or "curl".
- username
EarthData Login User
- password
EarthData Login Password
- netrc_path
Path to the .netrc file to be created. Defaults to the appropriate R package configuration location given by
tools::R_user_dir()
.- cookie_path
Path to the file where cookies will be stored. Defaults to the appropriate R package configuration location given by
tools::R_user_dir()
.- quiet
logical default TRUE. Show progress in download?
- ...
additional arguments to
download.file()
, e.g. quiet = TRUE.
Examples
if (FALSE) { # interactive()
href <- lpdacc_example_url()
edl_download(href)
}