focalWeight: Focal weights matrix

Description Usage Arguments Value Examples

Description

Calculate focal ("moving window") weight matrix for use in the focal function. The sum of the values adds up to one.

Usage

1
focalWeight(x, d, type=c('circle', 'Gauss', 'rectangle'))

Arguments

x

Raster* object

d

numeric. If type=circle, the radius of the circle (in units of the CRS). If type=rectangle the dimension of the rectangle (one or two numbers). If type=Gauss the size of sigma, and optionally another number to determine the size of the matrix returned (default is 3 times sigma)

type

character indicating the type of filter to be returned

Value

matrix that can be used in focal

Examples

1
2
3
r <- raster(ncols=36, nrows=18, xmn=0)
# Gaussian filter for square cells
gf <- focalWeight(r, 2, "Gauss")

Example output

Loading required package: sp
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files

raster documentation built on May 17, 2019, 3 a.m.