Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

unpad_raster

unpad_raster


Description

Adding padding to raster

Usage

unpad_raster(landscape, unpad_raster_cells, return_raster, to_disk)

## S3 method for class 'RasterLayer'
unpad_raster(
  landscape,
  unpad_raster_cells = 1,
  return_raster = TRUE,
  to_disk = getOption("to_disk", default = FALSE)
)

## S3 method for class 'RasterStack'
unpad_raster(
  landscape,
  unpad_raster_cells = 1,
  return_raster = TRUE,
  to_disk = getOption("to_disk", default = FALSE)
)

## S3 method for class 'RasterBrick'
unpad_raster(
  landscape,
  unpad_raster_cells = 1,
  return_raster = TRUE,
  to_disk = getOption("to_disk", default = FALSE)
)

## S3 method for class 'stars'
unpad_raster(
  landscape,
  unpad_raster_cells = 1,
  return_raster = TRUE,
  to_disk = getOption("to_disk", default = FALSE)
)

## S3 method for class 'list'
unpad_raster(
  landscape,
  unpad_raster_cells = 1,
  return_raster = TRUE,
  to_disk = getOption("to_disk", default = FALSE)
)

## S3 method for class 'matrix'
unpad_raster(
  landscape,
  unpad_raster_cells = 1,
  return_raster = FALSE,
  to_disk = getOption("to_disk", default = FALSE)
)

Arguments

landscape

Raster* Layer, Stack, Brick, SpatRaster (terra), stars, or a list of rasterLayers.

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

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

landscapemetrics

Landscape Metrics for Categorical Map Patterns

v1.5.2
GPL-3
Authors
Maximillian H.K. Hesselbarth [aut, cre] (<https://orcid.org/0000-0003-1125-9918>), Marco Sciaini [aut] (<https://orcid.org/0000-0002-3042-5435>), Jakub Nowosad [aut] (<https://orcid.org/0000-0002-1057-3721>), Sebastian Hanss [aut] (<https://orcid.org/0000-0002-3990-4897>), Laura J. Graham [ctb] (Input on package structure), Jeffrey Hollister [ctb] (Input on package structure), Kimberly A. With [ctb] (Input on package structure), Florian Privé [ctb] (Original author of underlying C++ code for get_nearestneighbour() function), Project Nayuki [ctb] (Original author of underlying C++ code for get_circumscribingcircle and lsm_p_circle), Matt Strimas-Mackey [ctb] (Bugfix in sample_metrics())
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.