I have loaded a raster using stars
package and then created tiles over the raster. Now i subset the raster based on these tile.
tiles[[i]] <- st_bbox(c(xmin=x0,ymin=y0,xmax=x1,ymax=y1),crs=st_crs(r))
crop_tiles[[i]] <- r[tiles[[i]]]
Here r
is raster loaded using read_stars("filename.tif")
.
Now i want to remove among the crop_tiles
the empty ones. i.e the tiles where the raster values are NA
You can check if all values of a
stars
object namedr
areNA
with:then remove those tiles where the above is equal to
TRUE
.For more specific code, please provide reproducible sample data in your question, thanks.