annualSummary: Annual summary of a time series RasterBrick

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Calculates pixel-based statistics for every year represented by a time series RasterBrick

Usage

1
2
annualSummary(x, fun, dates = NULL, years = NULL, sensor = NULL,
  na.rm = NULL, ...)

Arguments

x

RasterBrick or RasterStack

fun

Function to apply over each pixel for each year

dates

Date. Optional: vector of dates exactly corresponding to the layers of x. If not included, dates must be included in the z dimension of x (see getZ) or in names(x)

years

Numeric. Optional: Vector of years to which to limit the summary.

sensor

Character. Optional: limit calculation to images from a particular sensor. Defaults to "all", but can take any of "TM", "ETM+", "ETM+ SLC-off" or "ETM+ SLC-on". Will be ignored with a warning if names(x) do not correspond to Landsat scene ID's.

...

Arguments to be passed to mc.calc

Details

If fun takes a na.rm argument and none is supplied, the default value for na.rm for that function will be used.

Value

RasterBrick with results of fun for each year represented in the input time series RasterBrick.

Author(s)

Ben DeVries

See Also

summaryBrick

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# load tura RasterBrick
data(tura)

# calculate mean and standard deviation values per year for ETM+ data only
annualMean <- annualSummary(tura, fun=mean, na.rm=TRUE, sensor="ETM+")
plot(annualMean)
annualSD <- annualSummary(tura, fun=sd, na.rm=TRUE, sensor="ETM+")
plot(annualSD)

# custom function to calculate # of non-NA values per pixel per year (similar to countObs())
ff <- function(x)
 length(x[!is.na(x)])
annualObs <- annualSummary(tura, fun=ff, sensor="ETM+")

loicdtx/bfastSpatial documentation built on May 21, 2019, 7:37 a.m.