Learn R Programming

spatialEco (version 1.1-1)

smooth.time.series: Smooth Raster Time-series

Description

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 or brick class object

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)

Value

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

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).

See Also

loess for details on the loess regression

calc for details on additional (...) arguments

Examples

Run this code
# NOT RUN {
 # fill NA values
 lai.new <- smooth.time.series(lai)  

 # Smooth time-series with a relaxed smoothing parameter
 lai.smooth <- smooth.time.series(lai, f = 0.2, smooth.data = TRUE)  
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab