get_cbh_metrics {LadderFuelsR}R Documentation

Methods to estimated the Crown Base Height of a tree: maximum LAD percentage, maximum distance and the last distance

Description

This function determines the CBH of a segmented tree using three criteria: maximum LAD percentage, maximum distance and the last distance.

Usage

get_cbh_metrics(effective_LAD, min_height= 1.5, hdepth1_height = 2.5, verbose=TRUE)

Arguments

effective_LAD

Tree metrics with gaps (distances), fuel base heights, and depths of fuel layers with LAD percentage greater than a threshold (10 (output of [get_layers_lad()] function). An object of the class text.

min_height

Numeric value for the actual minimum base height (in meters).

hdepth1_height

Numeric value for the depth height of the first fuel layer. If the first fuel layer has the maximum LAD and its depth is greater than the indicated value, then this fuel layer is considered as the CBH of the tree. On the contrary, if its depth is <= the value, the CBH with maximum LAD will be the second fuel layer, although it has not the maximum LAD.

verbose

Logical, indicating whether to display informational messages (default is TRUE).

Details

List of tree metrics:

Value

A data frame giving the Crown Base Height (CBH) of a tree using three criteria: maximum LAD percentage, maximum distance and the last distance. For the case of maximum LAD CBH, the output gives the actual CBH with maximum LAD and also, the CBH from the second fuel layer when the first fuel layer has the maximum LAD but its depth is lesser than the value indicated in the parameter "hdepth1_height".

Author(s)

Olga Viedma, Carlos Silva, JM Moreno and A.T. Hudak

See Also

get_layers_lad

Examples

library(magrittr)
library(stringr)
library(dplyr)

# Before running this example, make sure to run get_real_depths().
if (interactive()) {
effective_LAD <- get_layers_lad()
LadderFuelsR::effective_LAD$treeID <- factor(LadderFuelsR::effective_LAD$treeID)

trees_name1 <- as.character(effective_LAD$treeID)
trees_name2 <- factor(unique(trees_name1))

cbh_dist_list <- list()

for (i in levels(trees_name2)) {
tree1 <- effective_LAD |> dplyr::filter(treeID == i)
cbh_dist_metrics <- get_cbh_metrics(tree1, min_height= 1.5,  hdepth1_height = 2.5, verbose=TRUE)
cbh_dist_list[[i]] <- cbh_dist_metrics
}

# Combine the individual data frames
cbh_metrics <- dplyr::bind_rows(cbh_dist_list)

# Get original column names
original_column_names <- colnames(cbh_metrics)

# Specify prefixes
desired_order <- c("treeID", "Hcbh", "dptf","effdist","dist", "Hdist", "Hdptf", "max_","last_",
"maxlad_","maxlad1_", "nlayers")

# Identify unique prefixes
prefixes <- unique(sub("^([a-zA-Z]+).*", "\\1", original_column_names))
# Initialize vector to store new order
new_order <- c()

# Loop over desired order of prefixes
for (prefix in desired_order) {
 # Find column names matching the current prefix
matching_columns <- grep(paste0("^", prefix), original_column_names, value = TRUE)
# Append to the new order
new_order <- c(new_order, matching_columns)
}
# Reorder values
cbh_metrics <- cbh_metrics[, new_order]
}

[Package LadderFuelsR version 0.0.6 Index]