temporalMetrics: Calculate temporal summary metrics

Description Usage Arguments Details See Also Examples

Description

This function calculates a set of user-defined or default statistics from a variable time series. If s is a Raster object, each layer should be a year of the time series. If s is a SpatialPointsDataFrame object, each column should be a year of the time series. 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 (calculated with mannKen) of the time series.

Usage

1
2
3
temporalMetrics(s, metrics = "defaultTemporalSummary", prefix = NULL,
  filename = "", par = F, threads = 2, progress = TRUE, m = 2,
  ...)

Arguments

s

Input Raster or SpatialPointsDataFrame object containing a time series (may be generated with calcIndices)

metrics

Name of a function used to process the time series provided as a character.

prefix

Optional. Character that will be added to the names of the output layers

filename

Character. Output filename including path to directory and eventually extension

par

Logical. Should the function be executed in parallel threads

threads

Number of parallel threads used if par = T

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 writeRaster

Details

If s is a Raster object, 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.

See Also

calc, cluster

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
funSummary <- function(x) {
  c(
    mean = mean(x, na.rm = T),
    median = median(x, na.rm = T),
    std = std(x, na.rm = T)
  )
}

temporalMetrics(s, metrics = "funSummary")

## End(Not run)

mqueinnec/foster documentation built on June 3, 2019, 4:22 a.m.