Skip to contents

Scans a directory for raster files (e.g., .tif, .tiff, .vrt) and removes those that contain only zero values. Uses spk_rast_not_empty() to check each raster.

Usage

spk_rast_rm_empty(
  path = NULL,
  delete = TRUE,
  regexp = "\\.(tif|tiff|vrt)$",
  quiet = FALSE
)

Arguments

path

character A single path to search for raster files.

delete

logical Whether to delete the empty files. Default is TRUE.

regexp

character A regular expression passed to fs::dir_ls() to select raster files. Default is '\.(tif|tiff|vrt)$'.

quiet

logical If FALSE, prints messages about files that are or can be removed. Default is FALSE.

Value

character A character vector of paths to the raster files that were empty. Returns invisibly.

Examples

if (FALSE) { # \dontrun{
# Remove empty rasters from a directory
spk_rast_rm_empty("path/to/rasters")
} # }