sgsR - Structurally Guided SamplingUniversity of British Columbia
2022-09-02
sgsR - R-package for structurally guided sampling for enhanced forest inventories.sgsR stands for structurally guided sampling implemented in R
Brief inventory and sampling overview
Discuss using auxiliary variables within sampling frameworks
Structurally guided sampling using Airborne Laser Scanning
sgsR overview
Programmatic examples of the package
Purpose: Obtain knowledge about the population (forest area) under investigation and provide estimates of specific target attributes
Needed information: Defined by the scope & scale of the inventory. Answered by questions like:
Sampling can be:
Time-tested
Simple
Efficient
Broadly used
✔️ Understand inventory attributes of interest
✔️ Associate auxiliary data correlated to those attributes
✔️ Sample across the full range of attribute variability
#--- perform stratification ---#
sraster <- strat_quantiles(mraster = mr$zq90, # p90
nStrata = 5) # 5 strata in p90#--- perform dual metric stratification ---#
sraster <- strat_quantiles(mraster = mr[[c(1,3)]], # p90 & zsd
nStrata = list(10,3))sgsRsgsR purpose sgsR is a toolbox to provide primarily model-based sampling approaches for management-level forest inventories that are:
sgsR was built using the terra, sf, & tidyverse packages
There are 4 primary function verbs that sgsR uses:
strat_* - apply stratification to metrics raster (mraster) and output a stratified raster (sraster)
sample_* - allocate samples using srasters produced from strat_* functions
calculate_*- calculate sample information or create useful intermediary sampling products
extract_* - extract pixels values from rasters to samples
Imagine you are a forester who needs some new plots
You love the idea of sgsR and want to use it
1️⃣ Read in some ALS metrics
1️⃣ Read in some ALS metrics
#--- Stratification ---#
#--- Load ALS metrics from sgsR internal data ---#
r <- system.file("extdata", "mraster.tif", package = "sgsR")
#--- Read ALS metrics using the terra package ---#
mraster <- terra::rast(r)2️⃣ Read in a linear road access network
#--- Load access network from sgsR internal data ---#
a <- system.file("extdata", "access.shp", package = "sgsR")
#--- load the access vector using the sf package ---#
access <- sf::st_read(a)3️⃣ Stratify p90 in to 4 strata based on quantiles
#--- perform stratification ---#
sraster <- strat_quantiles(mraster = mraster$zq90, # input ALS metric - p90
nStrata = 4) # desired number of strata (4)4️⃣ Now lets use the sraster output
#--- perform stratification ---#
sraster <- strat_quantiles(mraster = mraster$zq90, # input ALS metric - p90
nStrata = 4) # desired number of strata (4)
#--- perform sampling ---#
samples <- sample_strat(sraster = sraster,
nSamp = 100,
allocation = "proportional", # equal, manual, optimal
access = access,
buff_inner = 50,
buff_outer = 400)5️⃣ Request 100 samples
#--- perform stratification ---#
sraster <- strat_quantiles(mraster = mraster$zq90, # input ALS metric - p90
nStrata = 4) # desired number of strata (4)
#--- perform sampling ---#
samples <- sample_strat(sraster = sraster,
nSamp = 100,
allocation = "prop", # equal, manual, optimal
access = access,
buff_inner = 50,
buff_outer = 400)6️⃣ Sample proportional to stratum size
#--- perform stratification ---#
sraster <- strat_quantiles(mraster = mraster$zq90, # input ALS metric - p90
nStrata = 4) # desired number of strata (4)
#--- perform sampling ---#
samples <- sample_strat(sraster = sraster,
nSamp = 100,
allocation = "prop", # equal, manual, optimal
access = access,
buff_inner = 50,
buff_outer = 400)7️⃣ Bring in the access road
#--- perform stratification ---#
sraster <- strat_quantiles(mraster = mraster$zq90, # input ALS metric - p90
nStrata = 4) # desired number of strata (4)
#--- perform sampling ---#
samples <- sample_strat(sraster = sraster,
nSamp = 100,
allocation = "prop", # equal, manual, optimal
access = access,
buff_inner = 50,
buff_outer = 400)8️⃣ Specify we don’t want samples within 50 m of access
#--- perform stratification ---#
sraster <- strat_quantiles(mraster = mraster$zq90, # input ALS metric - p90
nStrata = 4) # desired number of strata (4)
#--- perform sampling ---#
samples <- sample_strat(sraster = sraster,
nSamp = 100,
allocation = "prop", # equal, manual, optimal
access = access,
buff_inner = 50,
buff_outer = 400)9️⃣ Or further than 400 m from access
#--- perform stratification ---#
sraster <- strat_quantiles(mraster = mraster$zq90, # input ALS metric - p90
nStrata = 4) # desired number of strata (4)
#--- perform sampling ---#
samples <- sample_strat(sraster = sraster,
nSamp = 100,
allocation = "prop", # equal, manual, optimal
access = access,
buff_inner = 50,
buff_outer = 400)access in A. Points are samples in both A & B
access constrained vs full extent for p90 (A) and zsd (B)
existing sampleexisting sampleexisting sampleLets create an existing sample of 50 plots using simple random sampling (sample_srs)
We are assuming these have been measured or used previously and can be revisited
existing sampleAdapted Hypercube Evaluation of a Legacy Sample (AHELS) (Malone, Minansy, and Brungard 2019)
sample_ahels() works by:
existing sample
existing sample1️⃣ We have our existing sample
existing sample2️⃣ Now we can use the sample_ahels() algorithm with our ALS metrics
existing sample3️⃣ Specify our existing sample
existing sample4️⃣ And specify we want 50 new sample units (nSamp)
existing samplesample_ahels() resultexisting only (A) and addition of new samples (B)
sgsR package provides many methods to implement SGS approachessgsR functionalitySpecial thanks to my collaborators
This presentation was made with Quarto and will be made available on Github following the presentation at ForestSAT