monthlyComposite {gimms} | R Documentation |
Calculate Monthly Composite Images
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
## 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 |
indices |
|
fun |
|
cores |
|
filename |
|
... |
Further arguments passed to |
version |
|
pos1 , pos2 |
|
Value
If length(x) == 2
, a single RasterLayer
object, else a
RasterStack
object with monthly composite layers.
See Also
stackApply
, monthlyIndices
,
writeRaster
.
Examples
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))