View source: R/raster.gaussian.smooth.R
raster.gaussian.smooth | R Documentation |
Applies a Gaussian smoothing kernel to smooth raster.
raster.gaussian.smooth(
x,
s = 2,
n = 5,
scale = FALSE,
type = c("mean", "median", "sd", "convolution"),
...
)
x |
A terra SpatRaster raster object |
s |
Standard deviation (sigma) of kernel (default is 2) |
n |
Size of the focal matrix, single value (default is 5 for 5x5 window) |
scale |
(FALSE/TRUE) Scale sigma to the resolution of the raster |
type |
The statistic to use in the smoothing operator; "mean", "median", "sd", "convolution" |
... |
Additional arguments passed to terra::focal |
This applies a Gaussian Kernel smoother. The convolution option performs a Gaussian decomposition whereas the other options use the kernel as weights for the given statistic.
A terra SpatRaster class object of the local distributional moment
Jeffrey S. Evans <jeffrey_evans@tnc.org>
library(terra)
elev <- rast(system.file("extdata/elev.tif", package="spatialEco"))
# Calculate Gaussian smoothing with sigma = 2 and 7x7 window
g1 <- raster.gaussian.smooth(elev, s=2, n=7)
plot(c(elev,g1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.