Learn R Programming

gimms (version 1.2.2)

monthlyIndices: Create Monthly Indices from NDVI3g Files

Description

Create numeric monthly indices from (local or online) GIMMS NDVI3g filenames as input for the monthlyComposite function.

Usage

monthlyIndices(
  x,
  version = 1L,
  pos1 = ifelse(version == 1, 15L, 4L),
  pos2 = ifelse(version == 1, 23L, 8L),
  timestamp = FALSE,
  ...
)

Value

A numeric vector with unique monthly indices or, if timestamp = TRUE, the actual timestamps as Date objects.

Arguments

x

character. Vector of (local or online) filenames.

version

integer (or any other class convertible to integer). Specifies GIMMS NDVI3g product version, see 'Details' in updateInventory.

pos1, pos2

numeric. The first and last element of the date string in 'x', defaults to the GIMMS naming convention of the specified product version.

timestamp

logical, defaults to FALSE. If TRUE, an actual Date object is returned rather than a numeric vector of indices.

...

Currently not used.

See Also

monthlyComposite.

Examples

Run this code
## NDVI3g.v1
gimms_files_v1 <- readRDS(system.file("extdata", "inventory_ecv1.rds", package = "gimms"))

monthlyIndices(gimms_files_v1[1], version = 1)                   # indices
monthlyIndices(gimms_files_v1[1], version = 1, timestamp = TRUE) # dates

## Similarly, NDVI3g.v0
gimms_files_v0 <- readRDS(system.file("extdata", "inventory_ecv0.rds", package = "gimms"))
gimms_files_v0 <- rearrangeFiles(gimms_files_v0) # reorder by date

monthlyIndices(gimms_files_v0[1:12], version = 0)
monthlyIndices(gimms_files_v0[1:12], version = 0, timestamp = TRUE)

Run the code above in your browser using DataLab