Description Usage Arguments Details Value Author(s) See Also Examples
Computes pixel-based summary statistics for a multi-layered raster object
1 2 |
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 |
minDate |
Date, Character or Numeric. Optional: minimum date to include in the calculation. Should either be supplied as a |
maxDate |
Date, Character or Numeric. Optional: maximum date to include in the calculation (see |
sensor |
Character. Optional: limit calculation to selected (Landsat) sensors. Defaults to |
... |
Additional arguments to be passed to |
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 "
A Raster layer representing the summary statistic of each pixel in the input RasterBrick or RasterStack
Ben DeVries
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.