rasterLocalQuantiles: Local quantiles for an in memory raster image

Description Usage Arguments Details Value Examples

View source: R/rasterLocalQuantiles.R

Description

rasterLocalQuantiles finds the quantile within the positive valued neighborhood of W.

Usage

1
rasterLocalQuantiles(r, W, q = 50)

Arguments

r

An in memory raster image.

W

A matrix of weights used to specify a local neighborhood. The quantile kernel will be applied to each pixel in r. Dimensions must be non-zero and odd.

q

A quantile. This value is required to be in the inclusive interval from 0 to 100.

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 quantile of the neighborhood identified by W. Only non-missing or neighbors with non-zero weights are used in the calculation. Quantile calculation uses the inverse empirical CDF transform, equivalent to stats::quantile type=1.

Value

An in memory raster image of local quantiles.

Examples

1
2
3
r <- raster::raster( matrix(rnorm(36),6,6)) 
W <- matrix(1,3,3)
medianR <- rasterLocalQuantiles(r,W)

rasterKernelEstimates documentation built on Sept. 21, 2021, 9:07 a.m.