I am currently using this:
any(as.numeric(terra::global(x, fun = "notNA")[,1]) > 0)
It works fine, but I think terra::global
is checking the entire raster. I’m looking for a method that stops when it finds the first non-NA value. This would save considerable time when checking a large SpatRaster.