Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CrownProfile class #311

Merged
merged 13 commits into from
Sep 30, 2024
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
Loading