Description Usage Arguments Details See Also Examples
View source: R/temporalMetrics.R
This function calculates a set of user-defined or default statistics from spectral indices time series.
1 2 3 4 5 6 7 8 9 10 11 |
x |
List of Raster* or SpatialPointsDataFrame objects.Input Raster or SpatialPointsDataFrame object containing a time series (may be generated with |
metrics |
Name of a function used to process the time series provided as a character. |
filename |
Character. Single output filename including path to directory and eventually extension. Each spectral index is written separately and the name of the spectral index is automatically appended to the file name. |
stack |
Logical. Should the output be returned as a single RasterStack (TRUE) or as a list containing one Raster per vegetation index (FALSE) |
par |
Logical. Should the function be executed in parallel threads |
threads |
Number of parallel threads used if par = TRUE |
progress |
Logical. If TRUE (default) a progress bar is displayed. |
m |
tuning parameter to determine how many blocks will be used (m blocks will be processed by each cluster) |
... |
Other arguments passed to |
Spectral indices can be calculated with calcIndices
.
The input to TemporalMetrics
is a list where each element is a Raster* or a SpatialPointsDataFrame object with layers or columns being spectral indices. Each element should be one step in the time series and elements should be ordered in the time series ascending order.
The argument fun
defines which metrics will be calculated. It has to be the name of a function that takes a vector as input and returns a named vector corresponding to the summary metrics. The function defaultTemporalSummary
is used by default and returns the median, IQR and Theil-Sen slope of the time series.
If x
is a list of Raster* objects, the processing can be parallelized using cluster
. In that case the user has to set par = TRUE
and provide the number of parallel threads threads
. You can control how many blocks will be processed by each thread by setting m
(see cluster
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # VI_ts is a list of Raster* calculated and saved from calcIndices
# Load it into memory
load(system.file("extdata/examples/VI_ts.RData",package="foster"))
temporalMetrics(VI_ts, metrics = "defaultTemporalSummary")
# User-defined temporal summary metrics can also be used
funSummary <- function(x) {
c(
mean = mean(x, na.rm = TRUE),
median = median(x, na.rm = TRUE),
std = sd(x, na.rm = TRUE)
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.