Skip to contents

Get mosaicked or merged raster from multiple MODIS hdf files.

Usage

process_modis_merge(
  path = NULL,
  date = NULL,
  subdataset = NULL,
  fun_agg = "mean",
  ...
)

Arguments

path

character. Full list of hdf file paths. preferably a recursive search result from base::list.files.

date

character(1). date to query. Should be in "YYYY-MM-DD" format.

subdataset

character(1). subdataset names to extract. Should conform to regular expression. See base::regex for details. Default is NULL, which will result in errors. Users should specify which subdatasets will be imported.

fun_agg

Function name or custom function to aggregate overlapping cell values. See fun description in terra::tapp for details.

...

For internal use.

Value

a SpatRaster object

Note

Curvilinear products (i.e., swaths) will not be accepted. MODIS products downloaded by functions in amadeus, MODISTools, and luna are accepted.

See also

Author

Insang Song

Examples

## NOTE: Example is wrapped in `\dontrun{}` as function requires a large
##       amount of data which is not included in the package.
if (FALSE) { # \dontrun{
mod09ga_merge <- process_modis_merge(
  path =
    list.files("./data", pattern = "MOD09GA.", full.names = TRUE),
  date = "2024-01-01",
  subdataset = "sur_refl_b01_1",
  fun_agg = "mean"
)
} # }