| download_modis | R Documentation |
Need maintenance for the directory path change in NASA EOSDIS. This function first retrieves the all hdf download links on a certain day, then only selects the relevant tiles from the retrieved links. Download is only done at the queried horizontal-vertical tile number combinations. An exception is MOD06_L2 product, which is produced every five minutes every day.
download_modis(
product = c("MOD09GA", "MYD09GA", "MOD09GQ", "MYD09GQ", "MOD09A1", "MYD09A1",
"MOD09Q1", "MYD09Q1", "MOD11A1", "MYD11A1", "MOD11A2", "MYD11A2", "MOD11B1",
"MYD11B1", "MOD13A1", "MYD13A1", "MOD13A2", "MYD13A2", "MOD13A3", "MYD13A3",
"MOD06_L2", "MCD19A2", "VNP46A2"),
version = "061",
nasa_earth_data_token = NULL,
date = c("2023-09-01", "2023-09-01"),
extent = c(-125, 22, -64, 50),
directory_to_save = NULL,
acknowledgement = FALSE,
download = FALSE,
remove_command = FALSE,
hash = FALSE
)
product |
character(1).
One of |
version |
character(1). Default is |
nasa_earth_data_token |
character(1). Token for downloading data from NASA. Should be set before trying running the function. |
date |
character(1 or 2). length of 10. Date or start/end dates for downloading data.
Format "YYYY-MM-DD" (ex. January 1, 2018 = |
extent |
numeric(4). Bounding box for downloading data.
Format is |
directory_to_save |
character(1). Directory to save data. |
acknowledgement |
logical(1). By setting |
download |
logical(1). Download data or only save wget commands. |
remove_command |
logical(1). Remove ( |
hash |
logical(1). By setting |
For hash = FALSE, NULL
For hash = TRUE, an rlang::hash_file character.
HDF (.hdf) files will be stored in year/day_of_year sub-directories within
directory_to_save.
Due to NASA data access policies, the download scripts generated by this function require a valid NASA Earthdata token for authentication and include options to slow down the download speed to avoid server overload and potential blocking of access.
Both dates in date should be in the same year.
Directory structure looks like
input/modis/raw/{version}/{product}/{year}/{day_of_year}.
Mitchell Manware, Insang Song
data_mcd19a22021amadeus
\insertRefdata_mod06l2_2017amadeus
\insertRefdata_mod09ga2021amadeus
\insertRefdata_mod11a12021amadeus
\insertRefdata_mod13a22021amadeus
\insertRefarticle_roman2018vnp46amadeus
## Not run:
## NOTE: Examples are wrapped in `/dontrun{}` to avoid sharing sensitive
## NASA EarthData tokden information.
vec_extent <- c(-80, 35, -75, 40)
# example with MOD09GA product
download_modis(
product = "MOD09GA",
version = "061",
date = "2024-01-01",
extent = vec_extent,
nasa_earth_data_token = "./pathtotoken/token.txt",
directory_to_save = tempdir(),
acknowledgement = TRUE,
download = FALSE, # NOTE: download skipped for examples,
remove_command = TRUE
)
# example with MOD06_L2 product
download_modis(
product = "MOD06_L2",
version = "6.1",
extent = vec_extent,
date = "2024-01-01",
nasa_earth_data_token = "./pathtotoken/token.txt",
directory_to_save = tempdir(),
acknowledgement = TRUE,
download = FALSE, # NOTE: download skipped for examples,
remove_command = TRUE
)
# example with VNP46A2 product
download_modis(
product = "VNP46A2",
version = "5200",
date = "2024-01-01",
extent = vec_extent,
nasa_earth_data_token = "./pathtotoken/token.txt",
directory_to_save = tempdir(),
acknowledgement = TRUE,
download = FALSE, # NOTE: download skipped for examples,
remove_command = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.