unpad_raster: unpad_raster

View source: R/unpad_raster.R

unpad_rasterR Documentation

unpad_raster

Description

Adding padding to raster

Usage

unpad_raster(
  landscape,
  unpad_raster_cells = 1,
  return_raster = TRUE,
  to_disk = getOption("to_disk", default = FALSE)
)

Arguments

landscape

A categorical raster object: SpatRaster; Raster* Layer, Stack, Brick; stars or a list of SpatRasters.

unpad_raster_cells

Number of rows and columns added

return_raster

If false, matrix is returned

to_disk

Logical argument, if FALSE results of get_patches are hold in memory. If true, unpad_raster writes temporary files and hence, does not hold everything in memory. Can be set with a global option, e.g. option(to_disk = TRUE).

Details

Removes equally (in all four directions) additional cells around the raster

Value

raster

Examples

landscape <- terra::rast(landscapemetrics::landscape)
lsm_padded <- pad_raster(landscape, pad_raster_cells = 2, pad_raster_value = -1)
unpad_raster(lsm_padded[[1]], unpad_raster_cells = 2)


landscapemetrics documentation built on Sept. 12, 2024, 7:42 a.m.