monthlyComposite: Calculate Monthly Composite Images

Description Usage Arguments Value See Also Examples

Description

Based on a user-defined function, e.g. max for maximum value composites (MVC), aggregate half-monthly GIMMS data sets to monthly composites.

Usage

1
2
3
4
5
6
7
8
## S4 method for signature 'RasterStackBrick'
monthlyComposite(x, indices, fun = max,
  cores = 1L, filename = "", ...)

## S4 method for signature 'character'
monthlyComposite(x, version = 1L,
  pos1 = ifelse(version == 1, 15L, 4L), pos2 = ifelse(version == 1, 23L,
  8L), fun = max, cores = 1L, filename = "", ...)

Arguments

x

Multi-layered Raster* object or character vector of filenames. If the latter applies and 'pos1', 'pos2' are not specified, the function will try to retrieve monthly indices from monthlyIndices. Note that the specification of NDVI3g.v0 ENVI binary files is hereby not allowed and in such a case, rasterizeGimms should be run beforehand.

indices

numeric. Indices to denote layers or files from identical months.

fun

function. Used to calculate monthly composite layers, defaults to max. Note that a separate 'na.rm' argument is passed down to stackApply via '...' and hence should not be included here.

cores

integer. Number of cores for parallel computing.

filename

character. Optional output filename passed to stackApply.

...

Further arguments passed to stackApply (i.e., 'na.rm') and its underlying writeRaster call.

version

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

pos1, pos2

integer. If 'x' is a vector of filenames, the first and last element of the date string to build monthly indices from. Defaults to the 'version'-specific NDVI3g naming convention, see monthlyIndices.

Value

If length(x) == 2, a single RasterLayer object, else a RasterStack object with monthly composite layers.

See Also

stackApply, monthlyIndices, writeRaster.

Examples

1
2
3
4
5
6
7
8
9
data("bale3g.v1")

## select layers from 1981 only
fls <- system.file("extdata/inventory_ecv1.rds", package = "gimms")
fls <- readRDS(fls)[1]
rst <- bale3g.v1[[1:12]]

## aggregate to monthly mvc layers
mvc <- monthlyComposite(rst, indices = monthlyIndices(fls))

gimms documentation built on May 29, 2017, 9:37 a.m.