mf_modisfast: Download (and possibly import) MODIS, VIIRS and GPM Earth...

View source: R/mf_modisfast.R

mf_modisfastR Documentation

Download (and possibly import) MODIS, VIIRS and GPM Earth Observation data

Description

Download 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

Usage

mf_modisfast(
  collection,
  variables,
  roi,
  time_range,
  path = tempfile("modisfast_"),
  parallel = FALSE,
  verbose = "inform",
  import = TRUE,
  ...
)

Arguments

collection

Collection identifier, e.g. '"MOD11A1.061"', '"VNP43MA4.002"' or '"GPM_3IMERGDF.07"'.

variables

One or more band names to retrieve, as returned by [mf_list_variables()].

roi

An 'sf' polygon with an 'id' column.

time_range

One date or two bounding dates.

path

string. Target folder for the data to download. Default : temporary folder.

parallel

boolean. Parallelize the download ? Default to FALSE

verbose

Character string: '"quiet"', '"inform"' (default), or '"debug"'. Controls progress messages; '"debug"' also shows request details.

import

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

Value

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).

See Also

mf_get_url, mf_download_data, mf_import_data

Examples

## Not run: 

### 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)

## End(Not run)

modisfast documentation built on Oct. 5, 2026, 1:06 a.m.