aggInterval.Rd 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/aggInterval.R
  3. \name{aggInterval}
  4. \alias{aggInterval}
  5. \title{Create Periods for Temporal Composites}
  6. \usage{
  7. aggInterval(x, interval = c("month", "year", "fortnight"))
  8. }
  9. \arguments{
  10. \item{x}{\code{Date} object, see eg default value of 'timeInfo' in
  11. \code{\link{temporalComposite}}.}
  12. \item{interval}{\code{character}. Time period for aggregation. Currently
  13. available options are "month" (default), "year" and "fortnight" (i.e., every
  14. 1st and 15th day of the month).}
  15. }
  16. \value{
  17. A \code{list} with the following slots:
  18. \itemize{
  19. \item{\code{$begin}: The start date(s) of each (half-)monthly timestep as
  20. \code{Date} object.}
  21. \item{\code{$end}: Same for end date(s).}
  22. \item{\code{$beginDOY}: Similar to \code{$begin}, but with \code{character}
  23. objects in MODIS-style date format (i.e., "\%Y\%j"; see \code{\link{strptime}}).}
  24. \item{\code{$endDOY}: Same for end date(s).}
  25. }
  26. }
  27. \description{
  28. The creation of custom temporal aggregation levels (e.g., half-monthly,
  29. monthly) from native 16-day MODIS composites usually requires the definition
  30. of date sequences based on which the "composite_day_of_the_year" SDS is
  31. further processed. Complementing \code{\link{transDate}}, which returns the
  32. respective start and end date only, this function creates full-year
  33. (half-)monthly or annual composite periods from a user-defined temporal range.
  34. }
  35. \examples{
  36. dates <- do.call("c", lapply(2015:2016, function(i) {
  37. start <- as.Date(paste0(i, "-01-01"))
  38. end <- as.Date(paste0(i, "-12-31"))
  39. seq(start, end, 16)
  40. }))
  41. intervals <- c("month", "year", "fortnight")
  42. lst <- lapply(intervals, function(i) {
  43. aggInterval(dates, interval = i)
  44. }); names(lst) <- intervals
  45. print(lst)
  46. }
  47. \seealso{
  48. \code{\link{transDate}}.
  49. }
  50. \author{
  51. Florian Detsch
  52. }