Title: | Ecosystem and Canopy Structural Complexity Metrics from LiDAR |
---|---|
Description: | Provides a toolkit for calculating forest and canopy structural complexity metrics from terrestrial LiDAR (light detection and ranging). References: Atkins et al. 2018 <doi:10.1111/2041-210X.13061>; Hardiman et al. 2013 <doi:10.3390/f4030537>; Parker et al. 2004 <doi:10.1111/j.0021-8901.2004.00925.x>. |
Authors: | Jeff Atkins [aut, cre], Gil Bohrer [aut], Robert Fahey [aut], Brady Hardiman [aut], Chrisopher Gough [aut], Timothy Morin [aut], Atticus Stovall [aut], Naupaka Zimmerman [ctb, aut], Chris Black [ctb] |
Maintainer: | Jeff Atkins <[email protected]> |
License: | GPL-3 |
Version: | 2.1.0 |
Built: | 2025-01-23 03:39:35 UTC |
Source: | https://github.com/atkinsjeff/forestr |
read_pcl
imports PCL or portable canopy LiDAR files into the workspace and formats them.This function specificially reads in PCL files that are in .csv format, standard format for that data type.
This function specificially reads in PCL files that are in .csv format, standard format for that data type.
read_pcl(f, ht.thresh) read_pcl_multi(data_directory, filename, ht.thresh)
read_pcl(f, ht.thresh) read_pcl_multi(data_directory, filename, ht.thresh)
f |
name of file currently being processed |
ht.thresh |
the height at which to filter values below |
data_directory |
directory where files are stored |
filename |
name of file to be imported |
# Link to raw PCL data, in .csv form. uva_pcl <- system.file("extdata", "UVAX_A4_01W.csv", package = "forestr") # Import PCL data to the workspace pcl_data <-read_pcl(uva_pcl, ht.thresh = 60) ## Not run: # This function runs internally right now. read_pcl_multi(data_directory, filename, ht.thresh) ## End(Not run)
# Link to raw PCL data, in .csv form. uva_pcl <- system.file("extdata", "UVAX_A4_01W.csv", package = "forestr") # Import PCL data to the workspace pcl_data <-read_pcl(uva_pcl, ht.thresh = 60) ## Not run: # This function runs internally right now. read_pcl_multi(data_directory, filename, ht.thresh) ## End(Not run)
adjust_by_user
adjusts data based on the user height to acccount
for the laser's distance from the ground.
adjust_by_user(df, user_height)
adjust_by_user(df, user_height)
df |
the data frame of raw pcl data |
user_height |
the height of the laser off the ground as mounted on the user in meters |
The function adjust_by_user
simply adds the height of the user to the
return distances in the data frame to estimate true height.
a data frame adjusted by height
# Adust raw data to account for user height as PCL is user-mounted and correction # gives actual distance from ground. pcl_adjusted <- adjust_by_user(pcl_coded, user_height = 1.05)
# Adust raw data to account for user height as PCL is user-mounted and correction # gives actual distance from ground. pcl_adjusted <- adjust_by_user(pcl_coded, user_height = 1.05)
calc_enl
calculates the effective number of layers in a canopy.
calc_enl(m, method)
calc_enl(m, method)
m |
a data frame of VAI for x, z bins from |
method |
"MH" is MacArthur-Horn and "Bohrer" is the Bohrer method |
the effective number of layers
# Calculates the effective number of layers calc_enl(pcl_vai, method = "Bohrer")
# Calculates the effective number of layers calc_enl(pcl_vai, method = "Bohrer")
calc_fhd
calculates foliage height diversity
calc_fhd(m, method)
calc_fhd(m, method)
m |
matrix of light adjusted vai values. |
method |
"MH" is MacArthur-Horn and "Bohrer" is the Bohrer method |
The calc_fhd
function calculates foliage height diversity, where a version of the Shannon-Weiner
diversity index is applied to through canopy measures of gap fraction
foliage height diveristy
calc_fhd(pcl_vai, method = "Bohrer")
calc_fhd(pcl_vai, method = "Bohrer")
calc_gap_fraction
produces clumping index based on
gap fraction through the canopy.
calc_gap_fraction(m)
calc_gap_fraction(m)
m |
the matrix of bin hits calculated as density of LiDAR returns for each x column. |
This is a specific function that works using the adjusted matrix to calculate gap fraction through the canopy. This function also returns clumping index.
calc_gap_fraction(pcl_vai)
calc_gap_fraction(pcl_vai)
calc_gini
calculates gini coefficient
calc_gini(m, method)
calc_gini(m, method)
m |
matrix of light adjusted vai values. |
method |
"MH" is MacArthur-Horn and "Bohrer" is the Bohrer method |
The calc_gini
function calculates gini coefficient, a varialbe the describes dissimilarity
gini coefficient
calc_gini(pcl_vai, method = "Bohrer")
calc_gini(pcl_vai, method = "Bohrer")
calc_intensity
calcualtes statistics from the intensity column of the PCL data
calc_intensity(df, filename)
calc_intensity(df, filename)
df |
data frame of uncorrected PCL data |
filename |
name of file currently being processed |
The calc_intensity
function calculates statistics about the intensity
data in the PCL data, including min, max, sd, mean, median.
statisics on the intensity data
intensity_stats <- calc_intensity(pcl_adjusted, filename = "UVA")
intensity_stats <- calc_intensity(pcl_adjusted, filename = "UVA")
calc_rugosity
calculates canopy structural complexity
metrics from PCL data and prints them to the screen.
calc_rugosity(df, m, filename, method)
calc_rugosity(df, m, filename, method)
df |
is a LiDAR summary matrix data frame |
m |
matrix of light adjusted vai values. |
filename |
the name of the file currently being processed. |
method |
"MH" is MacArthur-Horn and "Bohrer" is the Bohrer method |
This is a specific function calculates canopy rugosity and other metrics, including rumple, height metrics, etc.
a series of metrics that describe canopy and ecosystem height, density, openness, cover, etc.
# Calculates metrics of canopy structural complexity. calc_rugosity(pcl_summary, pcl_vai, filename = "", method = "Bohrer")
# Calculates metrics of canopy structural complexity. calc_rugosity(pcl_summary, pcl_vai, filename = "", method = "Bohrer")
calc_rumple
calculates canopy rumple.
calc_rumple(df)
calc_rumple(df)
df |
LiDAR summary matrix data frame |
This function uses the summary matrix created by
the function make_summary_matrix
to calculate
canopy rumple, the relationship between outer canopy surface
and the ground area.
rumple for the canopy based on 2-D transect
calc_rumple(pcl_summary)
calc_rumple(pcl_summary)
calc_tls_csc
calculates canopy structural complexity metrics from the tls vai matrix
calc_tls_csc(m, filename)
calc_tls_csc(m, filename)
m |
matrix of vai data with mean leaf height column |
filename |
the name of the file being process0 |
This is a specific function to calculate canopy structural complexity or CSC metrics from the VAI matrix imported in.
csc metrics
## Not run: calc_tls_csc(m) ## End(Not run)
## Not run: calc_tls_csc(m) ## End(Not run)
calc_tls_mean_leaf_ht
used in process_tls to calculate mean leaf height from tls slife
calc_tls_mean_leaf_ht(m)
calc_tls_mean_leaf_ht(m)
m |
the vai matrix |
This function derives mean leaf height from x, z vai from TLS data.
adds columns to the matrix of height.bin
# with designated file ## Not run: process_pcl("pcl_data.csv", marker.spacing = 10, user_height = 1.05, max.vai = 8)
# with designated file ## Not run: process_pcl("pcl_data.csv", marker.spacing = 10, user_height = 1.05, max.vai = 8)
calc_vai
calculates vegetation area index (VAI) from a normalized
matrix of LiDAR data.
calc_vai(df, max.vai)
calc_vai(df, max.vai)
df |
data frame of pcl data that has been corrected for light extinction
using the |
max.vai |
the maximum value of column VAI. The default is 8. Should be a max value, not a mean. |
a matrix of vai by x, z in the canopy
pcl_vai <- calc_vai(pcl_norm, max.vai = 8)
pcl_vai <- calc_vai(pcl_norm, max.vai = 8)
code_hits
classifies data values as canopy returns, sky returns, or
data markers.
code_hits(df)
code_hits(df)
df |
a raw set of pcl data |
The function code_hits
accounts for the NAs that are in
the return distance column which are actually
the sky hits (i.e. when the lidar does not record a canopy hit).
# classify data values that have been imported using read_pcl pcl_coded <- code_hits(pcl_data)
# classify data values that have been imported using read_pcl pcl_coded <- code_hits(pcl_data)
csc_metrics
creates first-order canopy structural metrics that
do not require normalization
csc_metrics(df, filename, transect.length)
csc_metrics(df, filename, transect.length)
df |
data frame of uncorrected PCL data |
filename |
name of file currently being processed |
transect.length |
the length of the transect |
The csc_metrics
function processes uncorrected PCL data to
generate canopy structural complexity (CSC) metrics that do not
require normalization (i.e. correction for light saturation based on
Beer-Lambert Law). These metrics include: mean return height of raw data, sd
of raw canopy height returns, maximum measured canopy height, scan density (the
average no. of LiDAR returns per linear meter), and both openness and cover
fraction which are used for gap fraction calculations.
slew of cover and sky fraction metrics
csc.metrics <- csc_metrics(pcl_adjusted, filename = "UVA", transect.length = 10)
csc.metrics <- csc_metrics(pcl_adjusted, filename = "UVA", transect.length = 10)
get_transect_length
acquires the length of a transect based on
a known marker spacing of the data markers stored in pcl data.
get_transect_length(df, marker.spacing)
get_transect_length(df, marker.spacing)
df |
data frame of unprocessed PCL data |
marker.spacing |
distance between transect markers, typically 5 or 10 m |
Returns the transect length of a given PCL file given a known marker spacing.
length of transect
# Get the length of the transect given a known spacing between data markers transect.length <- get_transect_length(pcl_data, marker.spacing = 10)
# Get the length of the transect given a known spacing between data markers transect.length <- get_transect_length(pcl_data, marker.spacing = 10)
make_matrix
produces a matrix of, x, z values in
coordinate space with the number and type of each LiDAR
return in each x, z bin combination
make_matrix(df)
make_matrix(df)
df |
data frame of PCL data that has been processed with
|
The make_matrix
function munges data in to a data frame
of x, z bins with the number of canopy hits located in each bin.
sorted matrix of LiDAR returns for each x, z position
pcl_matrix <- make_matrix(pcl_split)
pcl_matrix <- make_matrix(pcl_split)
make_matrix_part_one
produces a matrix of, x, z values in
coordinate space with the number and type of each LiDAR
return in each x, z bin combination
make_matrix_part_one(df)
make_matrix_part_one(df)
df |
data frame of PCL data that has been processed with |
sorted matrix of LiDAR returns for each x, z position
make_matrix_part_two
produces a matrix of, x, z values in
coordinate space with the number and type of each LiDAR
return in each x, z bin combination
make_matrix_part_two(df)
make_matrix_part_two(df)
df |
data frame of PCL data that has been processed with |
sorted matrix of LiDAR returns for each x, z position
make_summary_matrix
creates a summary matrix of data through data wrangling
the VAI data frame.
make_summary_matrix(df, m, method)
make_summary_matrix(df, m, method)
df |
sorted data frame of processed PCL data |
m |
matrix of PCL hit density with x and z coordinates |
method |
"MH" is MacArthur-Horn and "Bohrer" is the Bohrer method |
This makes a dataframe that is as long as a transect is. If the
transect is 40 m, this data frame has 40 rows. As input,
make_summary_matrix
requires a data frame of values
from split_transects_from_pcl
first, and second,
the data frame of VAI from the function calc_vai
.
#' This function allows you to express your love of cats.
a matrix of summary stats by each x and z coordinate position
pcl_summary <- make_summary_matrix(pcl_split, pcl_vai, method = "Bohrer")
pcl_summary <- make_summary_matrix(pcl_split, pcl_vai, method = "Bohrer")
normalize_pcl
normalizes a PCL matrix for occlusion.
normalize_pcl(df)
normalize_pcl(df)
df |
data frame of pcl hit density processed from
|
This function corrects saturated columns of LiDAR data for occlusion based on assumptions from the Beer-Lambert Law.
a data frame of PCL hit density corrected for light saturation and attentuation based on Beer's Law
pcl_norm <- normalize_pcl(pcl_matrix)
pcl_norm <- normalize_pcl(pcl_matrix)
normalize_pcl_mh
normalizes a PCL matrix for occlusion.
normalize_pcl_mh(df, k)
normalize_pcl_mh(df, k)
df |
data frame of pcl hit density processed from
|
k |
is a correction coefficent based on k = mean est. LAI/site LAI |
This function corrects saturated columns of LiDAR data for occlusion based on assumptions from the Beer-Lambert Law.
a data frame of PCL hit density corrected for light saturation and attentuation based on Beer's Law
pcl_norm <- normalize_pcl_mh(pcl_matrix, k = 1)
pcl_norm <- normalize_pcl_mh(pcl_matrix, k = 1)
A dataset that consists of one 40 m transect taken in a longleaf pine-oak savanna in North-central Florida. Data collected April, 2016 by J. Atkins and R. Fahey.
osbs
osbs
A data frame with 10506 rows:
index of raw data–position along transect
raw, uncorrected LiDAR return distances from laser
intensity values as recorded by LiDAR system
Derived from data collected at the University of Virginia Data collected August, 2016 by J. Atkins. Dervied from the calc_vai function
pcl_adjusted
pcl_adjusted
A data frame with 14576 rows:
index of raw data–position along transect
raw, uncorrected LiDAR return distances from laser
intensity values as recorded by LiDAR system
lidar return that does not hit the canopy
lidar return that hits the canopy
negative value that indicates marker
@source http://atkinsjeff.github.io
Derived from data collected at the University of Virginia Data collected August, 2016 by J. Atkins. Dervied from the calc_vai function
pcl_coded
pcl_coded
A data frame with 14576 rows:
index of raw data–position along transect
raw, uncorrected LiDAR return distances from laser
intensity values as recorded by LiDAR system
lidar return that does not hit the canopy
lidar return that hits the canopy
negative value that indicates marker
@source http://atkinsjeff.github.io
Derived from data collected at the University of Virginia Data collected August, 2016 by J. Atkins. Dervied from the calc_vai function
pcl_data
pcl_data
An object of class data.frame
with 14576 rows and 3 columns.
#' @format A data frame with 14576rows:
index of raw data–position along transect
raw, uncorrected LiDAR return distances from laser
intensity values as recorded by LiDAR system
pcl_diagnostic_plot
this function provides a diagnostic view of raw PCL data
pcl_diagnostic_plot(df, filename)
pcl_diagnostic_plot(df, filename)
df |
data frame of unprocessed PCL data |
filename |
name of file currently being processed |
This function provides a graphic view of raw PCL data to check for equal data spacing and marker spacing
a plot of PCL data showing marker spacing
# using the Ordway-Swisher Data set pcl_diagnostic_plot(osbs)
# using the Ordway-Swisher Data set pcl_diagnostic_plot(osbs)
Derived from data collected at the University of Virginia Data collected August, 2016 by J. Atkins. Dervied from the calc_vai function
pcl_matrix
pcl_matrix
A data frame with 1120 rows:
x-bin position
z-bin position
number of LiDAR returns at each x- and z- bin
total numer of sky hits per x column
total numer of canopy hits per x column
no. of lidar pulses emitted per column
no idea
@source http://atkinsjeff.github.io
Derived from data collected at the University of Virginia Data collected August, 2016 by J. Atkins. Dervied from the calc_vai function
pcl_norm
pcl_norm
A data frame with 1120 rows:
column numbering
x-bin position
z-bin position
number of LiDAR returns at each x- and z- bin
total numer of sky hits per x column
total numer of canopy hits per x column
no. of lidar pulses emitted per column
no idea
total number of hits distributed through canopy
percent of saturation
percent of returns distributed
counting variable
distributed proportion
coefficent
Derived from data collected at the University of Virginia Data collected August, 2016 by J. Atkins. Dervied from the calc_vai function
pcl_split
pcl_split
A data frame with 13982 rows:
index of raw data–position along transect
raw, uncorrected LiDAR return distances from laser
intensity values as recorded by LiDAR system
lidar return that does not hit the canopy
lidar return that hits the canopy
negative value that indicates marker
intermediate to get x position
intermediate to get x position
position along horizontal axis
position along vertical axis
Derived from data collected at the University of Virginia Data collected August, 2016 by J. Atkins. Dervied from the calc_vai function
pcl_summary
pcl_summary
A data frame with 40 rows:
x-bin position
mean height
standard deviation of mean leaf height
max measured height
highest measured max VAI
total VAI for the column
standard deviation of VAI
density adjuste height
height of peak VAI
mean leaf height
Derived from data collected at the University of Virginia Data collected August, 2016 by J. Atkins. Dervied from the calc_vai function
pcl_vai
pcl_vai
A data frame with 1120 rows:
column numbering
x-bin position
z-bin position
number of LiDAR returns at each x- and z- bin
total numer of sky hits per x column
total numer of canopy hits per x column
no. of lidar pulses emitted per column
no idea
total number of hits distributed through canopy
percent of saturation
percent of returns distributed
counting variable
distributed proportion
coefficent
cover proportion
max LAI or VAI number
calculated VAI
plot_hit_grid
produces a LiDAR hit grid plot
plot_hit_grid(m, filename, transect.length, max.ht, max.vai)
plot_hit_grid(m, filename, transect.length, max.ht, max.vai)
m |
matrix of light adjusted vai values. |
filename |
the name of the file currently being processed. |
transect.length |
the length of the transect used to create the x-axis |
max.ht |
the maximum measured height used to create the y-axis |
max.vai |
the maximum density of VAI, defaul = 8 |
a hit gride of VAI
# Calculates metrics of canopy structural complexity. plot_hit_grid(pcl_vai, filename = "UVA LiDAR data", transect.length = 40, max.ht = 30, max.vai = 8)
# Calculates metrics of canopy structural complexity. plot_hit_grid(pcl_vai, filename = "UVA LiDAR data", transect.length = 40, max.ht = 30, max.vai = 8)
plot_pavd
produces a PAVD plot from matrix data
plot_pavd(m, filename, plot.file.path.pavd, hist = FALSE, save_output = FALSE)
plot_pavd(m, filename, plot.file.path.pavd, hist = FALSE, save_output = FALSE)
m |
matrix of light adjusted vai values. |
filename |
the name of the file currently being processed. |
plot.file.path.pavd |
path of plot file to be written, inherited
from |
hist |
logical input to include histogram of VAI, if TRUE it is included, if FALSE, it is not. |
save_output |
if TRUE it saves the plot, if false it just runs |
This function is a nested function inside of process_pcl
. It could be run
independently using the summary_matrix.csv
output files created from running procesS_pcl
as well.
plant area volume density plots
# Calculates metrics of canopy structural complexity. plot_pavd(pcl_vai, filename = "pcl_test", hist = FALSE, save_output = FALSE) plot_pavd(pcl_vai, filename = "pcl_test", hist = TRUE, save_output = FALSE)
# Calculates metrics of canopy structural complexity. plot_pavd(pcl_vai, filename = "pcl_test", hist = FALSE, save_output = FALSE) plot_pavd(pcl_vai, filename = "pcl_test", hist = TRUE, save_output = FALSE)
process_multi_pcl
imports and processes multiple PCL transect.
process_multi_pcl( data_dir, user_height = NULL, method = NULL, k = NULL, marker.spacing = NULL, max.vai = NULL, ht.thresh = NULL, pavd = FALSE, hist = FALSE, save_output = TRUE )
process_multi_pcl( data_dir, user_height = NULL, method = NULL, k = NULL, marker.spacing = NULL, max.vai = NULL, ht.thresh = NULL, pavd = FALSE, hist = FALSE, save_output = TRUE )
data_dir |
directory where PCL .csv files are stored |
user_height |
height of laser from ground based on user in meters |
method |
"MH" is MacArthur-Horn and "Bohrer" is the Bohrer method |
k |
correction coeff for MH method (default is 1) |
marker.spacing |
space between markers in the PCL data, in meters |
max.vai |
the maximum value of column VAI. The default is 8. Should be a max value, not a mean. |
ht.thresh |
the height at which to filter values below |
pavd |
logical input to include Plant Area Volume Density Plot from [plot_pavd], if TRUE it is included, if FALSE, it is not. |
hist |
logical input to include histogram of VAI with PAVD plot, if TRUE it is included, if FALSE, it is not. |
save_output |
needs to be set to true, or else you are just going to get a lot of data on the screen |
This is a specific function that works using the input of a data directory of .csv
files where the function cycles through the files there and processes multiple
files, producing the same output files described in process_pcl
writes the hit matrix, summary matrix, and output variables to csv in an output folder, along with hit grid plot
# This function works on a directory of raw PCL data ## Not run: data_directory <- "./data/PCL_transects/" #data directory containing PCL transects process_multi_pcl(data_directory, user_height = 1.05, marker.spacing = 10, max.vai = 8, ht.thresh = 60, pavd = FALSE, h ist = FALSE, save_output = FALSE) process_multi_pcl("./data/PCL_transects/", user_height = 1.05, marker.spacing = 10, max.vai = 8, ht.thresh = 60, pavd = FALSE, hist = FALSE, save_output = FALSE) ## End(Not run)
# This function works on a directory of raw PCL data ## Not run: data_directory <- "./data/PCL_transects/" #data directory containing PCL transects process_multi_pcl(data_directory, user_height = 1.05, marker.spacing = 10, max.vai = 8, ht.thresh = 60, pavd = FALSE, h ist = FALSE, save_output = FALSE) process_multi_pcl("./data/PCL_transects/", user_height = 1.05, marker.spacing = 10, max.vai = 8, ht.thresh = 60, pavd = FALSE, hist = FALSE, save_output = FALSE) ## End(Not run)
process_pcl
imports and processes a single PCL transect.
process_pcl( f, method = NULL, data.type = NULL, user_height = NULL, k = NULL, transect.length = NULL, marker.spacing = NULL, max.vai = NULL, ht.thresh = NULL, pavd = FALSE, hist = FALSE, save_output = TRUE )
process_pcl( f, method = NULL, data.type = NULL, user_height = NULL, k = NULL, transect.length = NULL, marker.spacing = NULL, max.vai = NULL, ht.thresh = NULL, pavd = FALSE, hist = FALSE, save_output = TRUE )
f |
the name of the filename to input <character> or a data frame <data frame>. |
method |
"MH" is MacArthur-Horn and "Bohrer" is the Bohrer method |
data.type |
describes the type of data that is being feed into |
user_height |
the height of the laser off the ground as mounted on the user in meters. default is 1 m |
k |
correction coeff for MH method (default is 1) |
transect.length |
for 'continuous' data without markers, a total transect length is needed. |
marker.spacing |
distance between markers, defaults is 10 m |
max.vai |
the maximum value of column VAI. The default is 8. Should be a max value, not a mean. |
ht.thresh |
the height at which to filter values below default is 60 m |
pavd |
logical input to include Plant Area Volume Density Plot from plot_pavd, if TRUE it is included, if FALSE, it is not. |
hist |
logical input to include histogram of VAI with PAVD plot, if TRUE it is included, if FALSE, it is not. |
save_output |
the name of the output folder where to write all the output fields. |
This function imports raw pcl data or existing data frames of pcl data and writes all data and analysis to a series of .csv files in an output directory (output) keeping nothing in the workspace.
process_pcl
uses a workflow that cuts the data into 1 meter segments with
z and x positions in coordinate space where x refers to distance along the ground
and z refers to distance above the ground. Data are normalized based on
light extinction assumptions from the Beer-Lambert Law to account for light saturation.
Data are then summarized and metrics of canopy structure complexity are calculated.
process_pcl
will write multiple output files to disk in an output directory that
process_pcl
creates within the work directing. These files include:
1. an output variables file that contains a list of CSC variables and is
written by the subfunction write_pcl_to_csv
2. a summary matrix, that includes detailed information on each vertical column
of LiDAR data written by the subfunction write_summary_matrix_to_csv
3. a hit matrix, which is a matrix of VAI at each x and z position, written by the
subfunction write_hit_matrix_to_pcl
4. a hit grid, which is a graphical representation of VAI along the x and z coordinate space.
5. optionally, plant area/volume density profiles can be created by including
pavd = TRUE
that include an additional histogram with the optional
hist = TRUE
in the process_pcl
call.
writes the hit matrix, summary matrix, and output variables to csv in an output folder, along with hit grid plot
# Run process complete PCL transect without storing to disk uva.pcl <- system.file("extdata", "UVAX_A4_01W.csv", package = "forestr") process_pcl(uva.pcl, method = "MH", user_height = 1.05, k = 1, marker.spacing = 10, ht.thresh = 60, pavd = FALSE, hist = FALSE, save_output = FALSE) # with data frame process_pcl(osbs, marker.spacing = 10, user_height = 1.05, method = "Bohrer", k = 1, max.vai = 8, ht.thresh = 60, pavd = FALSE, hist = FALSE, save_output = FALSE)
# Run process complete PCL transect without storing to disk uva.pcl <- system.file("extdata", "UVAX_A4_01W.csv", package = "forestr") process_pcl(uva.pcl, method = "MH", user_height = 1.05, k = 1, marker.spacing = 10, ht.thresh = 60, pavd = FALSE, hist = FALSE, save_output = FALSE) # with data frame process_pcl(osbs, marker.spacing = 10, user_height = 1.05, method = "Bohrer", k = 1, max.vai = 8, ht.thresh = 60, pavd = FALSE, hist = FALSE, save_output = FALSE)
process_tls
imports and processes a slice from a voxelated TLS scan.
process_tls(f, slice, pavd = FALSE, hist = FALSE, save_output = TRUE)
process_tls(f, slice, pavd = FALSE, hist = FALSE, save_output = TRUE)
f |
the name of the filename to input <character> or a data frame <data frame>. |
slice |
the number of the transect to use from xyz tls data |
pavd |
logical input to include Plant Area Volume Density Plot from |
hist |
logical input to include histogram of VAI with PAVD plot, if TRUE it is included, if FALSE, it is not. |
save_output |
needs to be set to true, or else you are just going to get a lot of data on the screen |
This function takes as input a four column .CSV file or data frame of x, y, z, and VAI (Vegetation Area Index) derived from 3-D (TLS) LiDAR data. Currently, this function only analyzes a single slice from the inputed TLS data set. VAI is calculated externally by the user using user-determined methodology.
The process_tls
function will write multiple output files to disk in an (output)
directory that process_tls
creates within the work directing. These files include:
1. an output variables file that contains a list of CSC variables and is
written by the subfunction write_pcl_to_csv
2. a summary matrix, that includes detailed information on each vertical column of Lidar data
written by the subfunction write_summary_matrix_to_csv
3. a hit matrix, which is a matrix of VAI at each x and z position, written by the
subfunction write_hit_matrix_to_pcl
4. a hit grid, which is a graphical representation of VAI along the x and z coordinate space.
5. optionally, plant area/volume density profiles can be created by including
pavd = TRUE
that include an additional histogram with the optional hist = TRUE
in the
process_pcl
call.
writes the hit matrix, summary matrix, and output variables to csv in an output folder, along with hit grid plot
# with designated file uva.tls<- system.file("extdata", "UVAX_A4_01_tls.csv", package = "forestr") process_tls(uva.tls, slice = 5, pavd = FALSE, hist = FALSE, save_output = FALSE)
# with designated file uva.tls<- system.file("extdata", "UVAX_A4_01_tls.csv", package = "forestr") process_tls(uva.tls, slice = 5, pavd = FALSE, hist = FALSE, save_output = FALSE)
A dataset that consists of one 40 m transect taken in a red pine plantations in Northern Michigan. Data collected July, 2017 by J. Atkins.
red_pine
red_pine
A data frame with 17559 rows:
index of raw data–position along transect
raw, uncorrected LiDAR return distances from laser
intensity values as recorded by LiDAR system
split_transects_from_pcl
places data values into x-bins (x-coordinates
and) and z-bins (z-coordinates)
split_transects_from_pcl( pcl_data, transect.length, marker.spacing, DEBUG = FALSE, data_dir, output_file_name )
split_transects_from_pcl( pcl_data, transect.length, marker.spacing, DEBUG = FALSE, data_dir, output_file_name )
pcl_data |
data frame of unprocessed PCL data. |
transect.length |
total transect length. Default value is 40 meters. |
marker.spacing |
distance between markers in meters within the PCL data. Default value is 10 m. |
DEBUG |
check to see order of final output. Default is FALSE. |
data_dir |
directory where PCL data .csv are stored if value is used. |
output_file_name |
old code relic that doesn't do much. |
Function to add two additional columns to the pcl dataset, one for the segment (which should only be from 1-4) and is designated by a -99999999 value in the return_distance column The only required parameters are the data frame of pcl data, with the length of transect and the marker spacing.
# Function that has the algorithm that splits the raw data into defined, equidistant x-bins. pcl_split <- split_transects_from_pcl(pcl_adjusted, transect.length = 40, marker.spacing = 10)
# Function that has the algorithm that splits the raw data into defined, equidistant x-bins. pcl_split <- split_transects_from_pcl(pcl_adjusted, transect.length = 40, marker.spacing = 10)
write_hit_matrix_to_csv
writes hit matrix to .csv for further analysis
write_hit_matrix_to_csv(m, outputname, output_directory)
write_hit_matrix_to_csv(m, outputname, output_directory)
m |
matrix of VAI with z and x coordinates |
outputname |
name of file currently being processed |
output_directory |
directory where output goes |
This is a specific sub-function that writes the output variables to disk in .csv format
and runs within the functions process_pcl
, process_multi_pcl
, and
proces_tls
.
process_pcl
write_pcl_to_csv
write_summary_matrix_to_csv
## Not run: # This function runs internally. write_hit_matrix_to_csv(m, outputname, output_directory) ## End(Not run)
## Not run: # This function runs internally. write_hit_matrix_to_csv(m, outputname, output_directory) ## End(Not run)
write_pcl_to_csv
writes csc metrics and varialbes to .csv format
write_pcl_to_csv(output.variables, outputname, output_directory)
write_pcl_to_csv(output.variables, outputname, output_directory)
output.variables |
list of concatenated output variables |
outputname |
name of file currently being processed |
output_directory |
directory where output goes |
This is a specific function that writes the output variables to disk in .csv format
and runs within the functions process_pcl
, process_multi_pcl
, and
proces_tls
.
process_pcl
write_summary_matrix_to_csv
write_hit_matrix_to_csv
## Not run: write_pcl_to_csv(output_variables, outputname, output_directory) ## End(Not run)
## Not run: write_pcl_to_csv(output_variables, outputname, output_directory) ## End(Not run)
write_summary_matrix_to_csv
writes summary matrix to .csv format
write_summary_matrix_to_csv(m, outputname, output_directory)
write_summary_matrix_to_csv(m, outputname, output_directory)
m |
summary matrix |
outputname |
name of file currently being processed |
output_directory |
directory where output goes |
This is a specific subfunction that writes the summary matrix to disk in .csv format
and runs within the functions process_pcl
, process_multi_pcl
, and
proces_tls
.
write_pcl_to_csv
write_hit_matrix_to_csv
## Not run: write_summary_matrix_to_csv() ## End(Not run)
## Not run: write_summary_matrix_to_csv() ## End(Not run)