Returns the bearer token used for VIIRS/Black Marble downloads from NASA LAADS DAAC.
Details
Getting a token (web):
Create an account at https://urs.earthdata.nasa.gov
Accept the MERIS and Sentinel EULAs under Profile > EULAs
Go to Profile > Generate Token, click "Generate Token", then "Show Token"
Copy the token (starts with
EDL-) and store it
Supplying the token:
Set
EARTHDATA_TOKENenvironment variable (recommended: add to~/.Renviron)Or pass it directly as the
tokenargumentOr set
EARTHDATA_USERNAME+EARTHDATA_PASSWORDto fetch it automatically
Bhuvan NTL functions (bhuvan_stats(), bhuvan_raster()) do not require
any authentication.
Examples
if (FALSE) { # \dontrun{
# Option 1: token from Profile > Generate Token on urs.earthdata.nasa.gov
Sys.setenv(EARTHDATA_TOKEN = "EDL-xxxxxxxxxxxxxxxxxxxx")
token <- earthdata_token()
# Option 2: username + password (fetches token automatically)
Sys.setenv(EARTHDATA_USERNAME = "myuser", EARTHDATA_PASSWORD = "mypass")
token <- earthdata_token()
# Option 3: pass directly
token <- earthdata_token("EDL-xxxxxxxxxxxxxxxxxxxx")
} # }