get_depths {LadderFuelsR} | R Documentation |
This function calculates fuels depth as the difference between gaps interleaved between fuel layers minus one step if the fuel depths are greater than one step.
get_depths (LAD_profiles, distance_metrics,step= 1,min_height= 1.5, verbose=TRUE)
LAD_profiles |
original tree Leaf Area Density (LAD) profile (output of [lad.profile()] function in the leafR package. An object of the class text. |
distance_metrics |
tree metrics with gaps (distances) and fuel base heights (output of [get_distance()] function). An object of the class text. |
step |
Numeric value for the actual height bin step (in meters). |
min_height |
Numeric value for the actual minimum base height (in meters). |
verbose |
Logical, indicating whether to display informational messages (default is TRUE). |
# List of tree metrics:
treeID: tree ID with strings and numeric values
treeID1: tree ID with only numeric values
cbh - Height of the fuel layers base height (m)
gap - Height of gaps between consecutive fuel layers (m)
dist: Distance between consecutive fuel layers (m)
Hdist - Height of the distance between consecutive fuel layers (m)
depth - Depth of fuel layers (m)
Hdepth - Height of the depth of fuel layers (m)
max_height - Maximum height of the tree profile
A data frame giving fuel layers depth and the height of the depths in meters.
Olga Viedma, Carlos Silva, JM Moreno and A.T. Hudak
library(magrittr)
library(dplyr)
# Before running this example, make sure to run get_distance().
if (interactive()) {
distance_metrics <- get_distance()
LadderFuelsR::LAD_profiles$treeID <- factor(LadderFuelsR::LAD_profiles$treeID)
LadderFuelsR::distance_metrics$treeID <- factor(LadderFuelsR::distance_metrics$treeID)
metrics_depth_list <- list()
for (i in levels(LAD_profiles$treeID)){
tree1 <- LAD_profiles |> dplyr::filter(treeID == i)
tree2 <- distance_metrics |> dplyr::filter(treeID == i)
# Get depths for each tree
metrics_depth <- get_depths(tree1, tree2,step= 1,min_height= 1.5, verbose=TRUE)
metrics_depth_list[[i]] <- metrics_depth
}
# Combine the individual data frames
depth_metrics <- dplyr::bind_rows(metrics_depth_list)
}