aggInterval: Create Periods for Temporal Composites

View source: R/aggInterval.R

aggIntervalR Documentation

Create Periods for Temporal Composites

Description

The creation of custom temporal aggregation levels (e.g., half-monthly, monthly) from native 16-day MODIS composites usually requires the definition of date sequences based on which the "composite_day_of_the_year" SDS is further processed. Complementing transDate(), which returns the respective start and end date only, this function creates full-year (half-)monthly or annual composite periods from a user-defined temporal range.

Usage

aggInterval(x, interval = c("month", "year", "fortnight"))

Arguments

x

Date object, see e.g. default value of 'timeInfo' in temporalComposite.

interval

character. Time period for aggregation. Currently available options are "month" (default), "year" and "fortnight" (i.e., every 1st and 15th day of the month).

Value

A list with the following slots:

  • $begin: The start date(s) of each (half-)monthly timestep as Date object.

  • $end: Same for end date(s).

  • $beginDOY: Similar to $begin, but with character objects in MODIS-style date format (i.e., "%Y%j"; see strptime()).

  • $endDOY: Same for end date(s).

Author(s)

Florian Detsch

See Also

transDate().

Examples

dates <- do.call("c", lapply(2015:2016, function(i) {
  start <- as.Date(paste0(i, "-01-01"))
  end <- as.Date(paste0(i, "-12-31"))
  seq(start, end, 16)
}))

intervals <- c("month", "year", "fortnight")
lst <- lapply(intervals, function(i) {
  aggInterval(dates, interval = i)
}); names(lst) <- intervals

print(lst)


MODIS documentation built on Jan. 6, 2023, 5:10 p.m.