get_layers_lad {LadderFuelsR}R Documentation

Leaf Area Density (LAD) percentage comprised in each effective fuel layer

Description

This function calculates the percentage of Leaf Area Density (LAD) within each fuel layer (first output) and removes those fuel layers with LAD percentage less than a specified threshold, recalculating the distances and the depth of the remaining ones (second output).

Usage

get_layers_lad(LAD_profiles, effective_distances, threshold=25, verbose=TRUE)

Arguments

LAD_profiles

Original tree Leaf Area Density (LAD) profile (output of [lad.profile()] function in the leafR package). An object of the class text.

effective_distances

Tree metrics of fuel layers separated by distances greater than 1 m (output of [get_effective_gap()] function). An object of the class text.

threshold

Numeric value for the minimum required LAD percentage in a fuel layer. The default threshold is 25.

verbose

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

Details

Value

A data frame identifying the fuel layers with their corresponding LAD percentage.

Author(s)

Olga Viedma, Carlos Silva and JM Moreno

See Also

get_renamed_df

get_effective_gap

remove_no_flayer_noconsec

Examples

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

# LAD profiles derived from normalized ALS data after applying [lad.profile()] function
LAD_profiles <- read.table(system.file("extdata", "LAD_profiles.txt", package = "LadderFuelsR"),
header = TRUE)
LAD_profiles$treeID <- factor(LAD_profiles$treeID)

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

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

LAD_metrics1 <- list()
LAD_metrics2 <- list()

for (i in levels(trees_name2)) {
# Filter data for each tree
tree1 <- LAD_profiles |> dplyr::filter(treeID == i)
tree2 <- effective_distances |> dplyr::filter(treeID == i)

# Get LAD metrics for each tree
LAD_metrics <- get_layers_lad(tree1, tree2, threshold=25, verbose=TRUE)
LAD_metrics1[[i]] <- LAD_metrics$df1
LAD_metrics2[[i]] <- LAD_metrics$df2
}

all_LAD <- dplyr::bind_rows(LAD_metrics1)
effective_LAD <- dplyr::bind_rows(LAD_metrics2)
}

[Package LadderFuelsR version 0.0.4 Index]