smooth.time.series

0th

Percentile

Smooth Raster Time-series

Smooths pixel-level data in raster time-series and can impute missing (NA) values.

Usage
smooth.time.series(x, f = 0.8, smooth.data = FALSE, ...)
Arguments
x

A raster stack/brick or sp object with a @data slot

f

Smoothing parameter (see loess span argument)

smooth.data

(FALSE/TRUE) Smooth all of the data or just impute NA values

...

Additional arguments passed to raster calc (for writing results to disk)

Details

This function uses a LOESS regression to smooth the time-series (using the smooth.data = TRUE argument). If the data is smoothed, it will be replaced by a loess estimate of the time-series (estimated distribution at the pixel-level). The results can dramatically be effected by the choice of the smoothing parameter (f) so caution is warranted and the effect of this parameter tested. Alternately, with smooth.data = FALSE, the function can be used to impute missing pixel data (NA) in raster time-series (stacks/bricks).

Value

A raster stack or brick pr data.frame object with imputed NA values or smoothed data.

See Also

loess for details on the loess regression

calc for details on additional (...) arguments

Aliases
  • smooth.time.series
Examples
# NOT RUN {
 random.raster <- function(r=50, c=50, l=10, min=0, max=1){ 
   do.call(stack, replicate(l, raster(matrix(runif(r*c, min, max),r,c))))
 }
 r <- random.raster()

 # Smooth time-series 
 r.smooth <- smooth.time.series(r, f = 0.2, smooth.data = TRUE)  
 
 # sp SpatialPixelsDataFrame example
 r <- as(r, "SpatialPixelsDataFrame")
 r@data <- smooth.time.series(r, f = 0.2, smooth.data = TRUE)
 r <- stack(r) # coerce back to raster stack object

# }
Documentation reproduced from package spatialEco, version 1.3-2, License: GPL-3

Community examples

Looks like there are no examples yet.