summaryBrick: Summarize a RasterBrick

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

Description

Computes pixel-based summary statistics for a multi-layered raster object

Usage

1
2
summaryBrick(x, fun, dates = NULL, na.rm = NULL, minDate = NULL,
  maxDate = NULL, sensor = NULL, ...)

Arguments

x

RasterBrick or RasterStack to be summarized

fun

Function to apply to vectors extracted from each pixel

dates

Date. Optional: vector of dates corresponding exactly to layers of x

minDate

Date, Character or Numeric. Optional: minimum date to include in the calculation. Should either be supplied as a date or numeric of length 2 (see Details)

maxDate

Date, Character or Numeric. Optional: maximum date to include in the calculation (see subsetRasterTS). Should either be supplied as a date or numeric of length 2 (see Details)

sensor

Character. Optional: limit calculation to selected (Landsat) sensors. Defaults to NULL for all data.

...

Additional arguments to be passed to mc.calc

Details

This function is identical to calc, except for the fact that a number of sensor or date parameters are added to constrain the calculation.

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

If fun returns a vector of length greater than one, a RasterBrick object will be returned (see fun=range example in examples).

minDate and maxDate are optional arguments to limit the calculation to a specific date range. These arguments can be supplied as Date or Character objects in the form "

Value

A Raster layer representing the summary statistic of each pixel in the input RasterBrick or RasterStack

Author(s)

Ben DeVries

See Also

calc annualSummary

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# load tura dataset
data(tura)

# median value per pixel
medVI <- summaryBrick(tura, fun=median)
plot(medVI) # use na.rm=TRUE!!
medVI <- summaryBrick(tura, fun=median, na.rm=TRUE)
plot(medVI)

# custom pixel-wise function to count values > 7500
countVal <- function(x){
 return(length(which(x > 7500)))
}
vals <- summaryBrick(tura, fun=countVal)
plot(vals)

# the above could just as easily be done in calc() or mc.calc()
# but summaryBrick allows for additional parameters
# such as minDate and maxDate

# same function, but only for 2005
vals <- summaryBrick(tura, fun=countVal, minDate=c(2005, 1), maxDate=c(2006, 1))
# equivalent to:
vals <- summaryBrick(tura, fun=countVal, minDate="2005-01-01", maxDate="2006-01-01")

# range of values for each pixel
valRange <- summaryBrick(tura, fun=range, na.rm=TRUE)
plot(valRange)
# returns a brick with min and max values
# see ?range

dutri001/bfastSpatial documentation built on May 15, 2019, 6:05 p.m.