Learn R Programming

MODIS (version 1.2.11)

temporalComposite: Calculate MODIS Composite Images

Description

Based on a user-defined function, e.g. max() for maximum value composites (MVC), aggregate native 16-day MODIS data sets to custom temporal composites.

Usage

temporalComposite(
  x,
  y,
  timeInfo = extractDate(x, asDate = TRUE)$inputLayerDates,
  interval = c("month", "year", "fortnight"),
  fun = max,
  na.rm = TRUE,
  cores = 1L,
  filename = "",
  ...
)

Value

A Raster* object.

Arguments

x

Raster* or character. MODIS composite data set with an associated "composite_day_of_the_year" SDS, e.g. all vegetation indices products (MOD13).

y

Raster* or character. MODIS "composite_day_of_the_year" SDS associated with 'x'.

timeInfo

Date vector corresponding to all input layers. If not further specified, this is tried to be created through invoking extractDate() upon 'x', assuming standard MODIS file names.

interval

character. Time period for aggregation, see aggInterval().

fun, na.rm

function. See raster::overlay().

cores

integer. Number of cores for parallel processing.

filename

character. Optional output file name.

...

Additional arguments passed to raster::writeRaster().

Author

Florian Detsch

See Also

Examples

Run this code
if (FALSE) {
library(mapview)
frc <- as(subset(franconia, district == "Mittelfranken"), "Spatial")
tfs <- runGdal("MOD13A1", begin = "2015001", end = "2016366", extent = frc,
            job = "temporalComposite", SDSstring = "100000000010")

ndvi <- sapply(tfs[[1]], "[[", 1)
cdoy <- sapply(tfs[[1]], "[[", 2)

mmvc <- temporalComposite(ndvi, cdoy)
plot(mmvc[[1:4]])
}

Run the code above in your browser using DataLab