raster.gaussian.smooth {spatialEco}R Documentation

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

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

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.

Value

A terra SpatRaster class object of the local distributional moment

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

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


[Package spatialEco version 2.0-2 Index]