rasterLocalSums {rasterKernelEstimates} | R Documentation |
Local sums for an in memory raster image.
Description
rasterLocalSums
finds the local sum within the weighted neighborhood of W.
Usage
rasterLocalSums(r, W)
Arguments
r |
An in memory raster image. |
W |
A matrix of weights. The sums will be applied at each centroid. Dimensions must be non-zero and odd. Only non-missing neighbors are used in the sum. |
Details
A spatial neighborhood is calculated for each pixel in r
.
The spatial neighborhood for each pixel is defined by the weight matrix
W
, where the center of the odd dimensioned matrix W
is identified
with the target pixel. The target pixel value is replaced with the sum of
all pixels within the neighborhood weighted by W
. Only non-missing
or neighbors with non-zero weights are used in the calculation.
Value
An in memory raster image of local sums.
Examples
r <- raster::raster( matrix(rnorm(36),6,6))
W <- matrix(1,3,3)
sumR <- rasterLocalSums(r,W)
[Package rasterKernelEstimates version 1.0.2 Index]