sample_strat {sgsR} | R Documentation |
Stratified sampling
Description
Sampling based on a stratified raster.
Usage
sample_strat(
sraster,
nSamp,
allocation = "prop",
method = "Queinnec",
weights = NULL,
force = FALSE,
mraster = NULL,
mindist = NULL,
existing = NULL,
include = FALSE,
remove = FALSE,
access = NULL,
buff_inner = NULL,
buff_outer = NULL,
wrow = 3,
wcol = 3,
plot = FALSE,
details = FALSE,
filename = NULL,
overwrite = FALSE
)
Arguments
sraster |
spatRaster. Stratification raster to be used for sampling. |
nSamp |
Numeric. Number of desired samples. |
allocation |
Character. Allocation algorithm to be used. Either |
method |
Character. Sampling design approach |
weights |
Numeric. Only applicable when |
force |
Logical. |
mraster |
spatRaster. ALS metric raster. Required when |
mindist |
Numeric. Minimum allowable distance between selected
samples. |
existing |
sf 'POINT' or data.frame. Existing plot network. |
include |
Logical. If |
remove |
Logical. If |
access |
sf 'LINESTRING' or 'MULTILINESTRING'. Access network. |
buff_inner |
Numeric. Inner buffer boundary specifying distance from access where plots cannot be sampled. |
buff_outer |
Numeric. Outer buffer boundary specifying distance from access where plots can be sampled. |
wrow |
Numeric. Number of row in the focal window ( |
wcol |
Numeric. Number of columns in the focal window ( |
plot |
Logical. Plots samples of type 'existing' (if provided; croses) and 'new' (circles) along with |
details |
Logical. If |
filename |
Character. Path to write output samples. |
overwrite |
Logical. Choice to overwrite existing |
Value
An sf object with nSamp
stratified samples.
Note
The sampling is performed in 2 stages when method = "Queinnec"
:
-
Rule 1
- Sample within grouped stratum pixels defined within thewrow, wcol
parameters -
Rule 2
- If no samples exist to satisfy Rule 1 individual stratum pixels are sampled.The rule applied to allocate each sample is defined in the
rule
attribute of output samples.
existing
may contain samples that fall in sraster
cells that are 'NA'. If this occurs and include = TRUE
, 'NA' samples
are separated during sampling and re-appended at the end of the sampling process.
If the sraster
provided contains factor values, the algorithm will automatically convert these into the numeric factor levels and
perform sampling using those values. The categories (factor values) will be extracted and appended to the algorithm output as the 'category' attribute.
Author(s)
Tristan R.H. Goodbody & Martin Queinnec
References
Queinnec, M., White, J. C., & Coops, N. C. (2021). Comparing airborne and spaceborne photon-counting LiDAR canopy structural estimates across different boreal forest types. Remote Sensing of Environment, 262 (August 2020), 112510. https://doi.org/10.1016/j.rse.2021.112510
See Also
Other sample functions:
sample_ahels()
,
sample_balanced()
,
sample_clhs()
,
sample_existing()
,
sample_nc()
,
sample_srs()
,
sample_sys_strat()
,
sample_systematic()
Examples
#--- Load raster and access files ---#
r <- system.file("extdata", "sraster.tif", package = "sgsR")
sr <- terra::rast(r)
#--- perform stratified sampling random sampling ---#
sraster <- sample_strat(
sraster = sr,
nSamp = 50
)