R/test_helpers.R

Defines functions testhelp_load_rast

# These functions are used only for testing purposes

# Load a test raster using the temp directory

testhelp_load_rast <- function(path) {
  ext <- tools::file_ext(path)
  tmp <- tempfile(fileext = paste0(".", ext))
  file.copy(path, tmp, overwrite = TRUE)

  x <- terra::rast(tmp)

  return(x)
}

Try the rasterpic package in your browser

Any scripts or data that you put into this service are public.

rasterpic documentation built on Sept. 8, 2023, 5:54 p.m.