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 StemAllocation class #308

Merged
merged 2 commits into from
Sep 30, 2024
Merged

Add StemAllocation class #308

merged 2 commits into from
Sep 30, 2024

Conversation

davidorme
Copy link
Collaborator

Description

Very similar to the last PR #305!

This PR introduces the demography.t_model_functions StemAllocation class. This bundles the allocation equations from the T Model into a higher level wrapper that takes:

  • a Flora | StemTraits instance to provide stem traits,
  • a StemAllometry instance that provides stem size and scaling calculations, and
  • an array of potential GPP values to be allocated to respiration, turnover and growth.

This class isn't used yet in the demography simulation workflow but will be. It also works as a user-facing visualisation tool. The PR also adds a simple test to confirm that the bundled allocation calculations still agree with the expected values tested on the individual functions.

Fixes #307

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@davidorme davidorme linked an issue Sep 30, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.84%. Comparing base (1f315ba) to head (fabf312).
Report is 164 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #308      +/-   ##
===========================================
+ Coverage    95.29%   95.84%   +0.54%     
===========================================
  Files           28       34       +6     
  Lines         1720     2404     +684     
===========================================
+ Hits          1639     2304     +665     
- Misses          81      100      +19     
Flag Coverage Δ
95.84% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@MarionBWeinzierl MarionBWeinzierl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@davidorme davidorme merged commit 29c49f8 into develop Sep 30, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Add StemAllocation class
3 participants