nh_crop | R Documentation |
This function will reduce the extent of a raster, by removing rows/columns from all sides which do not have any non-NA cells with a value greater than zero. One buffer row/column is left on each side.
nh_crop(rast)
rast |
input raster |
SpatRaster
David Bucklin
## Not run:
rast <- terra::rast("_data/species/ambymabe/outputs/model_predictions/ambymabe_20171018_130837.tif")
values(rast) <- ifelse(values(rast) > 0.3, 1, NA)
rast.crop <- nh_crop(rast)
# should be TRUE
sum(values(rast), na.rm=T) == sum(values(rast.crop), na.rm=T)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.