Sample a random DEM with specified size from a larger DEM
dem_sample(data, L, allow_NA = TRUE, plot = FALSE, max_iter = 100)
Digital elevation model of class RasterLayer.
Size of square to cut out of DEM.
Logical. Allow NAs in the sample? Useful when DEM is not regular.
Logical. Plot the DEM and the cropped section?
Maximum number of random crops to try when allow_NA = FALSE before failing.
Digital elevation model of class RasterLayer.
Not allowing NAs may increase sampling time for irregular DEMs that contain a lot of NAs; e.g., structure from motion transects.
dem <- dem_sample(horseshoe, L = 2, plot=TRUE)