Skip to content

Commit

Permalink
Fixes from @MarionBWeinzierl
Browse files Browse the repository at this point in the history
  • Loading branch information
davidorme committed Sep 23, 2024
1 parent 901b790 commit 6a13444
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions pyrealm/demography/canopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def __init__(
for layer in np.arange(self.n_layers - 1):
target_area = (layer + 1) * community.cell_area * (1 - canopy_gap_fraction)

# TODO - the solution here is predictably closer to the upper bracket, might
# be a better algorithm to find the root.
# TODO - the solution here is typically closer to the upper bracket, might
# be a better algorithm to find the root (#293).
solution = root_scalar(
solve_community_projected_canopy_area,
args=(
Expand All @@ -106,6 +106,9 @@ def __init__(
self.layer_heights[layer] = starting_guess = solution.root

# Find relative canopy radius at the layer heights
# NOTE - here and in the calls below, validate=False is enforced because the
# Community class structures and code should guarantee valid inputs and so
# turning off the validation internally should simply speed up the code.
self.stem_relative_radius: NDArray[np.float32] = (
calculate_relative_canopy_radius_at_z(
z=self.layer_heights,
Expand Down
5 changes: 3 additions & 2 deletions pyrealm/demography/canopy_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,9 @@ def calculate_stem_projected_leaf_area_at_z(
validate: Boolean flag to suppress argument validation.
"""

# TODO - could this merge with the stem crown area function? A lot of overlap, so
# could be much more efficient to return both from one function.
# NOTE: Although the internals of this function overlap a lot with
# calculate_stem_projected_crown_area_at_z, we want that function to be as
# lean as possible, as it used within solve_community_projected_canopy_area.

if validate:
_validate_z_args(z, crown_area, stem_height, f_g, q_m, z_max)
Expand Down

0 comments on commit 6a13444

Please sign in to comment.