mw_create: Create focal ("moving window") weight matrix

View source: R/utils.R

mw_createR Documentation

Create focal ("moving window") weight matrix

Description

Create a focal ("moving window") weight matrix for use in terra::focal().

Usage

mw_create(r, radius)

Arguments

r

SpatRaster.

radius

radius of the circle (in units of the crs).

Details

mw_create() is a modified version of terra::focalMat(). While terra::focalMat() creates a matrix where the border is the distance from the center of the focal cell, mw_create() creates a matrix where the border of the moving window is the distance from the edge of the focal cell.

Author(s)

Martin Haringa


spatialrisk documentation built on June 8, 2025, 9:40 p.m.