| rasterLocalQuantiles {rasterKernelEstimates} | R Documentation |
Local quantiles for an in memory raster image
Description
rasterLocalQuantiles finds the quantile within the positive valued neighborhood
of W.
Usage
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 |
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
r <- raster::raster( matrix(rnorm(36),6,6))
W <- matrix(1,3,3)
medianR <- rasterLocalQuantiles(r,W)