Description Usage Arguments Details Value Author(s) See Also Examples
Calculates pixel-based statistics for every year represented by a time series RasterBrick
1 2 |
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 |
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 |
... |
Arguments to be passed to |
If fun
takes a na.rm
argument and none is supplied, the default value for na.rm
for that function will be used.
RasterBrick with results of fun
for each year represented in the input time series RasterBrick.
Ben DeVries
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+")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.