spatial_clip function

Clip values of spatial data.

Clip values of spatial data.

The function replaces raster values based on different thresholds.

spatial_clip(data, quantile, replace = NA, normalise = TRUE)

Arguments

  • data: SpatRaster object, spatial data set to be processed.
  • quantile: Numeric value, quantile value below which raster values are clipped.
  • replace: Numeric value, replacement value, default is NA.
  • normalise: Logical value, optionally normalise values above threshold quantile between 0 and 1. Default is TRUE.

Returns

SpatRaster object, data set with clipped values.

Examples

## load example data set data(volcano) ## convert matrix to raster object volcano <- terra::rast(volcano) ## clip values to those > quantile 0.5 volcano_clip <- spatial_clip(data = volcano, quantile = 0.5) ## plot clipped data set terra::plot(volcano_clip)

Author(s)

Michael Dietze

  • Maintainer: Michael Dietze
  • License: GPL-3
  • Last published: 2025-03-25

Useful links