raster_clump: Wrapper for 'raster::clump' on 'stars' objects

Description Usage Arguments Value Examples

View source: R/raster_clump.R

Description

This is a wrapper around raster::clump, to apply the function on stars objects without needing to convert to and from a Raster* object. (The function uses the gaps=FALSE setting.)

Usage

1

Arguments

x

A stars object

Value

A stars object with the unique IDs for patches of connected cells that are not 0 or NA

Examples

1
2
3
4
5
6
7
library(stars)
tif = system.file("tif/L7_ETMs.tif", package = "stars")
r = read_stars(tif)
r = r > 100
r_clump = raster_clump(r)
plot(r)
plot(r_clump)

michaeldorman/geobgu documentation built on Jan. 6, 2021, 3:57 p.m.