Skip to contents

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 name. Defaults to the EARTHDATA_USER environment variable, or else the login stored for urs.earthdata.nasa.gov in ~/.netrc. Register for a free account at https://urs.earthdata.nasa.gov.

password

Earthdata Login password. Defaults to the EARTHDATA_PASSWORD environment variable, or else the password stored for urs.earthdata.nasa.gov in ~/.netrc.

netrc_path

Path to the .netrc file to be created. Defaults to the appropriate R package configuration location given by tools::R_user_dir().

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.

Value

the dest path, invisibly

Examples

if (FALSE) { # interactive()
href <- lpdacc_example_url()
edl_download(href)
}