Smooth Raster Time Series

Smooth a sequence of 'terra' rasters using various algorithms (currently moving average, weighted moving average, and exponential smoothing). Also includes wrappers to smooth a vector time-series using these same algorithms. All smoothers use 'Rcpp' implementations for performance.


ssmooth

R-CMD-check format-check

Run time series smoothing on terra::SpatRaster objects. Applies a simple smoothing algorithm to each pixels' time series. Currently supports simple moving average, weighted moving average, and exponential smoothing.

Installation

Install from CRAN via:

install.packages("ssmooth")

Alternatively, install the development version from this GitHub repo via:

# install.packages("pak")
pak::pkg_install("Biodiversity-Futures-Lab/ssmooth")

Usage

The main function of interest is SmoothRasterTS, which applies a smoother over the raster time-series:

# library(ssmooth)
r <- terra::rast(nrow = 2, ncol = 2, nlyrs = 10)
terra::values(r) <- rep(1:4, each = 10)
SmoothRasterTS(r, "mean")

We assume that the layers are temporally ordered (oldest -> newest): if time information is detected in the layers (terra::time()), then smoothing will be applied in temporal order. If no time information is found then smoothing will be applied across layers in the order given.

As well, we also provide a lower-level function SmoothTS that applies smoothing to a single numeric vector, which is what SmoothRasterTS uses under the hood:

# library(ssmooth)
x <- runif(10)
SmoothTS(x, "mean", n = 3)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("ssmooth")

0.1.0 by Connor Duffin, 4 months ago


https://github.com/Biodiversity-Futures-Lab/ssmooth


Report a bug at https://github.com/Biodiversity-Futures-Lab/ssmooth/issues


Browse source code at https://github.com/cran/ssmooth


Authors: Connor Duffin [aut, cre] , The Trustees of The Natural History Museum , London [cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports terra, Rcpp

Suggests testthat

Linking to Rcpp


See at CRAN