raster.gaussian.smooth

0th

Percentile

Gaussian smoothing of raster

Applies a Gaussian smoothing kernel to smooth raster.

Usage
raster.gaussian.smooth(x, sigma = 2, n = 5, type = mean, ...)
Arguments
x

raster object

sigma

standard deviation (sigma) of kernel (default is 2)

n

Size of the focal matrix, single value (default is 5 for 5x5 window)

type

The statistic to use in the smoothing operator (suggest mean or sd)

...

Additional arguments passed to raster::focal

Value

raster class object of the local distributional moment

Note

This is a simple wrapper for the focal function, returning local statistical moments

Aliases
  • raster.gaussian.smooth
Examples
# NOT RUN {
   library(raster)
   r <- raster(nrows=500, ncols=500, xmn=571823, xmx=616763, 
               ymn=4423540, ymx=4453690)
proj4string(r) <- crs("+proj=utm +zone=12 +datum=NAD83 +units=m +no_defs")
   r[] <- runif(ncell(r), 1000, 2500)
   r <- focal(r, focalWeight(r, 150, "Gauss") )
 
 # Calculate Gaussian smoothing with sigma(s) = 1-4
 g1 <- raster.gaussian.smooth(r, sigma=1, nc=11)
 g2 <- raster.gaussian.smooth(r, sigma=2, nc=11)
 g3 <- raster.gaussian.smooth(r, sigma=3, nc=11)
 g4 <- raster.gaussian.smooth(r, sigma=4, nc=11)

opar <- par(no.readonly=TRUE)
par(mfrow=c(2,2)) 
  plot(g1, main="Gaussian smoothing sigma = 1") 
  plot(g2, main="Gaussian smoothing sigma = 2")
  plot(g3, main="Gaussian smoothing sigma = 3")
  plot(g4, main="Gaussian smoothing sigma = 4")
par(opar)

# }
Documentation reproduced from package spatialEco, version 1.3-2, License: GPL-3

Community examples

Looks like there are no examples yet.