Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Clarify rachis_length_reference #39

@VEZY

Description

@VEZY

Clarify what rachis_length_reference means in stem_diameter, and what value should be passed into it.

"""
stem_diameter(rachis_length_reference, stem_diameter_max, stem_diameter_slope, stem_diameter_inflection, stem_diameter_residual)
Computes the stem diameter (m) at a given rachis length reference (m).
# Arguments
- `rachis_length_reference`: The rachis length reference (m). Taken as the rachis length of the first leaf.
- `stem_diameter_max`: The maximum stem diameter (m).
- `stem_diameter_slope`: The slope of the logistic function.
- `stem_diameter_inflection`: The inflection point of the logistic function.
- `stem_diameter_residual`: The residual of the stem diameter (m).
- `stem_diameter_snag`: The diameter estimation due to snags (m).
# Optional arguments
- `rng`: The random number generator.
# Details
The stem diameter is computed using a logistic function, and then some variability is added to simulate natural variations that might occur in real-world scenarios.
"""
function stem_diameter(rachis_length_reference, stem_diameter_max, stem_diameter_slope, stem_diameter_inflection, stem_diameter_residual, stem_diameter_snag; rng=Random.MersenneTwister(1234))
# Logistic function for stem diameter
# !!!!!!!
# The rachis length reference is supposed to be the first value of the rachisLengths vector.
# Not present yet in the parameters yaml file.
# !!!!!!!
stem_diameter = logistic(rachis_length_reference, stem_diameter_max, stem_diameter_slope, stem_diameter_inflection)
# Add some variability to the stem_diameter, simulating natural variations that might occur in real-world scenarios:
# Note that we use max(0.3 * stem_diameter,...) to ensure that the stem diamter is always at least 30% of the maximum diameter.
stem_diameter = max(0.3 * stem_diameter, mean_and_sd(stem_diameter, stem_diameter_residual; rng=rng))
# Remove extra diameter estimation due to snags
stem_diameter = stem_diameter - min(stem_diameter_snag, 0.6 * stem_diameter)
return stem_diameter
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions