This RMD file explores a plot from the Fernow Experimental Forest in WV, close to where we did our field experiments. I used GPS coordinates 39°03’00.8”N 79°39’57.3”W and created a 0.1 sqm plot in the general area.

setwd("C:/Users/ragha/OneDrive/Documents/Work & Clubs/Steel_Research/Trees")
#install.packages("lidR")
#install.packages("RCSF")
#install.packages("terra")

library(lidR) #Collection of tools for processing and analyzing LIDAR data
library(RCSF) #Helps separate ground from non-ground points
library(terra) #Does spatial data analysis with raster and vector data
library(viridis) #Works on colouring
library(raster) #Manipulates raster data or data organized in grids of pixels
las = readLAS('Fernow_1.laz')
las
## class        : LAS (v1.4 format 7)
## memory       : 153.8 Mb 
## extent       : -8868692, -8868028, 4728540, 4729058 (xmin, xmax, ymin, ymax)
## coord. ref.  : WGS 84 / Pseudo-Mercator 
## area         : 346852 m²
## points       : 1.75 million points
## type         : airborne
## density      : 5.05 points/m²
## density      : 2.7 pulses/m²
chm <- rasterize_canopy(las, res = 1, algorithm = pitfree())
plot(chm, main = "Canopy Height Model")

chm <- rasterize_canopy(las, res = 0.5, algorithm = p2r())
plot(chm, main = "Canopy Height Model")

ws_values <- c(3, 6, 9, 12, 15)
th_values <- c(0.1, 0.2, 0.3, 0.4, 0.5)

invisible(capture.output(
  las_classified <- classify_ground(las, algorithm = pmf(ws = ws_values, th = th_values))
)) #Suppress some output messages

dtm <- rasterize_terrain(las_classified, res = 1, algorithm = knnidw())
plot(dtm, main = "Digital Terrain Model")