R/mf_modisfast.R
mf_modisfast.RdDownload and possibly import MODIS, VIIRS and GPM Earth Observation data quickly and efficiently. This function is a wrapper for mf_get_url, mf_download_data and mf_import_data. Whenever possible, users should prefer executing the functions mf_get_url, mf_download_data and mf_import_data sequentially rather than using this high-level function
mf_modisfast(
collection,
variables,
roi,
time_range,
path = tempfile("modisfast_"),
parallel = FALSE,
verbose = "inform",
import = TRUE,
...
)Collection identifier, e.g. `"MOD11A1.061"`, `"VNP43MA4.002"` or `"GPM_3IMERGDF.07"`.
One or more band names to retrieve, as returned by [mf_list_variables()].
An `sf` polygon with an `id` column.
One date or two bounding dates.
string. Target folder for the data to download. Default : temporary folder.
boolean. Parallelize the download ? Default to FALSE
Character string: `"quiet"`, `"inform"` (default), or `"debug"`. Controls progress messages; `"debug"` also shows request details.
boolean. Import the data as a SpatRast object ? default TRUE. FALSE will download the data but not import them it in R.
Further arguments to be passed to mf_import_data
if the parameter import is set to TRUE, a terra::SpatRast
object ; else a data.frame providing details of the data downloaded
(see output of mf_download_data).
if (FALSE) { # \dontrun{
### Set-up parameters of interest
coll <- "VJ121A2.002"
bands <- c("LST_Day_1KM", "LST_Night_1KM")
time_range <- as.Date(c("2026-01-01", "2026-01-30"))
roi <- sf::st_as_sf(
data.frame(
id = "roi_test",
geom = "POLYGON ((-5.82 9.54, -5.42 9.55, -5.41 8.84, -5.81 8.84, -5.82 9.54))"
),
wkt = "geom", crs = 4326
)
### Download and import the data
Sys.setenv(EARTHDATA_TOKEN = "your Earthdata bearer token")
modis_ts <- mf_modisfast(
collection = coll,
variables = bands,
roi = roi,
time_range = time_range
)
### Plot the data
terra::plot(modis_ts)
} # }