build_forest_profile {fractalforest}R Documentation

Construct a 2D Forest Profile Using L-System Trees from Inventory Data.

Description

Construct a 2D Forest Profile Using L-System Trees from Inventory Data.

Usage

build_forest_profile(
  data,
  height,
  diameter,
  label,
  string = NULL,
  tree_model = "binary_tree",
  n_iter = NULL,
  angle = 15,
  crown_diameter = NULL,
  h_reduction = (1 + sqrt(5))/2 - 1,
  d_reduction = (1 + sqrt(5))/2 - 1,
  randomness = FALSE,
  angle_cv = 0.1,
  length_cv = 0.1,
  leaf_size = NULL,
  sample = TRUE,
  n_trees,
  dist = 3,
  dist_cv = 0
)

Arguments

data

A data frame containing forest inventory data (field-measured or simulated). Each row represents an individual tree.

height

Name of the column (character) containing tree heights, measured in meters.

diameter

Name of the column (character) containing tree diameters, measured in centimeters.

label

Name of the column (character) containing tree labels or unique IDs.

string

The column (character) or string containing turtle graphics instructions generated by the iterate_lsystem function. If NULL (default), the tree_model argument is used to create instructions.

tree_model

The predefined tree model to use when string is NULL. Accepts either an integer or a character string corresponding to a model name (e.g., 'binary_tree'). See fractal_tree_model() for details.

n_iter

An integer specifying the number of iterations to generate the tree_model when string is NULL. Defaults to model-specific settings.

angle

A numeric value specifying the branching angle (in degrees). Default is 15.

crown_diameter

Column name (unquoted) or numeric value for the crown diameter of the trees. Default is NULL.

h_reduction

A numeric value representing the reduction factor applied to branch lengths. Default is the golden ratio ((1+\sqrt{5})/2 - 1).

d_reduction

A numeric value representing the reduction factor applied to branch diameters. Default is the golden ratio ((1+\sqrt{5})/2 - 1).

randomness

A logical value. If set to TRUE, randomness is introduced to the branch angles. Default is FALSE.

angle_cv

A numeric value specifying the coefficient of variation for branch angles, applied when randomness is set to TRUE. Default is 0.1.

length_cv

A numeric value specifying the coefficient of variation for branch lengths, applied when randomness is set to TRUE. Default is 0.1.

leaf_size

An unquoted column name or a numeric value specifying the size of the leaves. Defaults to NULL, in which case the d_reduction value is used.

sample

A logical value. If TRUE, rows are sampled from data to construct the forest. The default is TRUE.

n_trees

An integer specifying the number of trees to sample when sample is set to TRUE..

dist

A numeric value representing the average linear distance between trees. The default is 3.

dist_cv

A numeric value representing the coefficient of variation for tree distances. The default is 0.3.

Details

Value

A data frame containing the 2D forest profile data, with individual tree id, component coordinates, component types, labels and diameters.

Examples

# Example data
data <- data.frame(
  height = c(10, 12, 14, 12, 18, 15, 13, 16, 10, 8, 10, 7),
  diameter = c(12, 15, 11, 17, 25, 18, 10, 21, 12, 10, 10, 11),
  label = c("Tree1", "Tree2", "Tree3","Tree4", "Tree5", "Tree6",
            "Tree7", "Tree8", "Tree9", "Tree10", "Tree11", "Tree12")
)

# Build forest profile
build_forest_profile(
  data = data,
  height = height,
  diameter = diameter,
  label = label,
  tree_model = "binary_tree",
  n_trees = 3
)

[Package fractalforest version 1.0.1 Index]