Clamp values to a minimum and maximum value. That is, all values below the lower clamp value and above the upper clamp value become NA (or the lower/upper value if useValue=TRUE)
Usage
# S4 method for Raster
clamp(x, lower=-Inf, upper=Inf, useValues=TRUE, filename="", ...)
# S4 method for numeric
clamp(x, lower=-Inf, upper=Inf, ...)
Value
Raster object
Arguments
x
RasterLayer, or numeric vector
lower
numeric. lowest value
upper
numeric. highest value
useValues
logical. If FALSE values outside the clamping range become NA, if TRUE, they get the extreme values
filename
character. Filename for the output RasterLayer (optional)