dem_sample: Sample a random DEM with specified size from a larger DEM

View source: R/dem_sample.R

dem_sampleR Documentation

Sample a random DEM with specified size from a larger DEM

Description

Sample a random DEM with specified size from a larger DEM

Usage

dem_sample(data, L, allow_NA = TRUE, plot = FALSE, max_iter = 100)

Arguments

data

Digital elevation model of class RasterLayer.

L

Size of square to cut out of DEM.

allow_NA

Logical. Allow NAs in the sample? Useful when DEM is not regular.

plot

Logical. Plot the DEM and the cropped section?

max_iter

Maximum number of random crops to try when allow_NA = FALSE before failing.

Value

Digital elevation model of class RasterLayer.

Note

Not allowing NAs may increase sampling time for irregular DEMs that contain a lot of NAs; e.g., structure from motion transects.

Examples

dem <- dem_sample(horseshoe, L = 2, plot=TRUE)


habtools documentation built on May 29, 2024, 7:30 a.m.