Skip to content

Commit

Permalink
Merge pull request #311 from ImperialCollegeLondon/309-add-canopyprof…
Browse files Browse the repository at this point in the history
…ile-class

Add `CrownProfile` class
  • Loading branch information
davidorme authored Sep 30, 2024
2 parents 29c49f8 + 502968d commit 81b3c21
Show file tree
Hide file tree
Showing 7 changed files with 364 additions and 279 deletions.
14 changes: 7 additions & 7 deletions pyrealm/demography/canopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from numpy.typing import NDArray
from scipy.optimize import root_scalar # type: ignore [import-untyped]

from pyrealm.demography.canopy_functions import (
calculate_relative_canopy_radius_at_z,
from pyrealm.demography.community import Community
from pyrealm.demography.crown import (
calculate_relative_crown_radius_at_z,
calculate_stem_projected_crown_area_at_z,
calculate_stem_projected_leaf_area_at_z,
solve_community_projected_canopy_area,
)
from pyrealm.demography.community import Community


class Canopy:
Expand Down Expand Up @@ -114,7 +114,7 @@ def _calculate_canopy(self, community: Community) -> None:
community.stem_traits.m,
community.stem_traits.n,
community.stem_traits.q_m,
community.stem_allometry.canopy_z_max,
community.stem_allometry.crown_z_max,
community.cohort_data["n_individuals"],
target_area,
False, # validate
Expand All @@ -134,7 +134,7 @@ def _calculate_canopy(self, community: Community) -> None:
# 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 = calculate_relative_canopy_radius_at_z(
self.stem_relative_radius = calculate_relative_crown_radius_at_z(
z=self.layer_heights,
stem_height=community.stem_allometry.stem_height,
m=community.stem_traits.m,
Expand All @@ -149,7 +149,7 @@ def _calculate_canopy(self, community: Community) -> None:
crown_area=community.stem_allometry.crown_area,
stem_height=community.stem_allometry.stem_height,
q_m=community.stem_traits.q_m,
z_max=community.stem_allometry.canopy_z_max,
z_max=community.stem_allometry.crown_z_max,
validate=False,
)

Expand All @@ -161,6 +161,6 @@ def _calculate_canopy(self, community: Community) -> None:
stem_height=community.stem_allometry.stem_height,
f_g=community.stem_traits.f_g,
q_m=community.stem_traits.q_m,
z_max=community.stem_allometry.canopy_z_max,
z_max=community.stem_allometry.crown_z_max,
validate=False,
)
Loading

0 comments on commit 81b3c21

Please sign in to comment.