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

Complete implementation of T model functions #285

Merged
merged 9 commits into from
Sep 18, 2024

Conversation

davidorme
Copy link
Collaborator

Description

This PR:

  • Completes the suite of functions needed for running the T Model within the new demography module. It is basically unpacking the current pyrealm.tmodel.TModel.calculate_growth method for estimating growth increments into standalone functions with proper docstrings etc. following @AmyOctoCat 's similar treatment of pyrealm.tmodel.TModel.reset_diameters for the allometric scaling.
  • Updates the regression test datasets from the rtmodel.r implementation to include predictions from more than one plant functional type.
  • Adds regression tests for all of the functions in pyrealm.demography.t_model_functions against those new regression golden outputs.

Does not add any user-facing documentation yet.

Fixes #284

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

@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.17%. Comparing base (1f315ba) to head (1db5cc2).
Report is 75 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #285      +/-   ##
===========================================
- Coverage    95.29%   95.17%   -0.12%     
===========================================
  Files           28       32       +4     
  Lines         1720     2093     +373     
===========================================
+ Hits          1639     1992     +353     
- Misses          81      101      +20     

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

@MarionBWeinzierl
Copy link
Collaborator

When putting in assertions, would it make sense to set a tolerance for allclose ? As, I assume, it can be quite different what an acceptable deviation for the expected value is in a each case.

@davidorme
Copy link
Collaborator Author

When putting in assertions, would it make sense to set a tolerance for allclose ? As, I assume, it can be quite different what an acceptable deviation for the expected value is in a each case.

These ones are purely deterministic and should be precise - or at least to the high default tolerance of allclose. They more or less should be identical to machine precision.

.. math::
P_{net} = y (P - R_m) = y (P - W_{\cdot s} r_s - \zeta \sigma W_f r_r - P r_f)

Note that this differs from Equation 13 of :cite:t:`Li:2014bc`, which removes foliar
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a citation for this approach?

Copy link
Collaborator Author

@davidorme davidorme Sep 18, 2024

Choose a reason for hiding this comment

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

No - it's a "new" approach but only in the pretty trivial sense that the foliage respiration rate can be tuned. I'll clarify that.

@j-emberton
Copy link
Collaborator

Looks fine to me aside from the queries on citations. Happy to approve and let you update the docstrings as you wish.

@j-emberton j-emberton self-requested a review September 18, 2024 08:08
Copy link
Collaborator

@j-emberton j-emberton left a comment

Choose a reason for hiding this comment

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

LGTM

@davidorme davidorme merged commit 33a7e9d into develop Sep 18, 2024
12 checks passed
@davidorme davidorme deleted the 284-complete-implementation-of-t-model-functions branch September 18, 2024 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Complete implementation of T Model functions in demography module and test better.
4 participants