Description Usage Arguments Value Author(s) Examples
View source: R/RmSmallCellChunks.R
Remove small cell chunks from a raster layer, where a cell chunk is defined as a group of connected cells with non-missing values. The cell chunk with the largest surface area is preserved and all others removed.
1 |
r |
'RasterLayer'. Raster grid layer with cell values. |
An object of class 'RasterLayer' giving
r
with cell values in the smaller cell chunks set to NA
.
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
1 2 3 4 5 6 7 8 9 10 11 | set.seed(2)
r <- raster::raster(ncols = 10, nrows = 10)
r[] <- round(runif(raster::ncell(r)) * 0.7)
r <- raster::clump(r)
r <- raster::ratify(r)
PlotMap(r)
r_new <- RmSmallCellChunks(r)
PlotMap(r_new)
graphics.off()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.