the function allows to automatically set to NoData eventual outliers present in a raster single- or multi-band object (or file). For each band, quantiles of the distribution of pixel values are computed using raster::quantile, and the values falling outside the limits set with the tails argument are set to NoData in the output

cuttails_rast(in_rast, tails = c(0.02, 0.98), to_file = FALSE,
  verbose = TRUE)

Arguments

in_rast

*raster object (single layer or stack), or filename of a raster file

tails

numeric array (2) quantiles of the distribution of pixel values used for the cut. For example, setting tails = c(0.05, 0.95) will set to NoData all pixels below the 5th and above the 95th percentile, Default: c(0.02, 0.98)

to_file

DESCRIPTION

verbose

DESCRIPTION

Value

OUTPUT_DESCRIPTION

Details

DETAILS

Examples

# on single band in_rast <- raster::raster(ncol=100, nrow=100) in_rast <- raster::setValues(in_rast, 1:10000) in_rast_cut <- cuttails_rast(in_rast) in_rast_cut
#> class : RasterLayer #> dimensions : 100, 100, 10000 (nrow, ncol, ncell) #> resolution : 3.6, 1.8 (x, y) #> extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax) #> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 #> data source : in memory #> names : layer #> values : 201, 9800 (min, max) #>
# on multi band in_brick <- raster::stack(in_rast,in_rast,in_rast) in_brick
#> class : RasterStack #> dimensions : 100, 100, 10000, 3 (nrow, ncol, ncell, nlayers) #> resolution : 3.6, 1.8 (x, y) #> extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax) #> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 #> names : layer.1, layer.2, layer.3 #> min values : 1, 1, 1 #> max values : 10000, 10000, 10000 #>
in_brick_cut <- cuttails_rast(in_brick) in_brick_cut
#> class : RasterStack #> dimensions : 100, 100, 10000, 3 (nrow, ncol, ncell, nlayers) #> resolution : 3.6, 1.8 (x, y) #> extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax) #> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 #> names : layer.1, layer.2, layer.3 #> min values : 201, 201, 201 #> max values : 9800, 9800, 9800 #>