spatialEco (version 2.0-2)

raster.gaussian.smooth: Gaussian smoothing of raster

Description

Applies a Gaussian smoothing kernel to smooth raster.

Usage

raster.gaussian.smooth(
  x,
  s = 2,
  n = 5,
  scale = FALSE,
  type = c("mean", "median", "sd", "convolution"),
  ...
)

Value

A terra SpatRaster class object of the local distributional moment

Arguments

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

Author

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Details

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.

Examples

Run this code
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))

Run the code above in your browser using DataLab