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

Refactor yearly net uptake #644

Open
glemieux opened this issue May 7, 2020 · 0 comments
Open

Refactor yearly net uptake #644

glemieux opened this issue May 7, 2020 · 0 comments

Comments

@glemieux
Copy link
Contributor

glemieux commented May 7, 2020

This issue came up in the context of review #623 (comment). The trim_canopy routine uses this variable to check to see if there has been activity in a leaf layer for a given year:

if (currentCohort%year_net_uptake(z) /= 999._r8)then !there was activity this year in this leaf layer.

As noted by @rgknox this type of equivalence check against real numbers should be avoided. This type of check is also present in DeallocateCohort:
do i=1, nlevleaf
if (currentCohort%year_net_uptake(i) == 999._r8 .or. nextc%year_net_uptake(i) == 999._r8) then
currentCohort%year_net_uptake(i) = &
min(nextc%year_net_uptake(i),currentCohort%year_net_uptake(i))
else
currentCohort%year_net_uptake(i) = (currentCohort%n*currentCohort%year_net_uptake(i) + &
nextc%n*nextc%year_net_uptake(i))/newn
endif
enddo

Given that this is slightly beyond the scope of #623, I'm breaking this out into a separate issue to be addressed later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ❕Todo
Development

No branches or pull requests

1 participant