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

New PModelEnvironment implementation #412

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

davidorme
Copy link
Collaborator

@davidorme davidorme commented Feb 4, 2025

Description

This PR updates the definition of PModelEnvironment to the proposed structure in the version 2.0.0 sketch in #394

  • The fAPAR and PPFD forcing variables are now included in the list of arguments,
  • All of the other directly defined arguments for optional variables are removed (theta, rootzonestress, mean_growth_temperature, aridity_index) and instead __init__ treats all kwargs variables as potential additional variables.
  • The class uses the new BoundsChecker to validate inputs.
  • The changes add tk as an internal attribute.

It also updates all of the test and doc usages of PModelEnvironment. It does not remove usage of fAPAR and PPFD outside of PModelEnvironment - these will become redundant when #401 is merged, addressing #386 and #385, so I'll tidy up on that branch.

Tip

There are a lot of files changed because of all the test and docstring usage of this core class, but the main thing to review is the new pmodel_environment.py file.

Important

Having had to update mutiple test and doc files to set fapar=1, ppfd=1, I think it makes sense to have these two variables default to one.

90% of the time, users will want to set them, but some use cases don't need fapar and ppfd and it is annoying to have to do so. Can you see any downsides to this tweak?

Fixes #390

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 Feb 4, 2025 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 78.78788% with 7 lines in your changes missing coverage. Please review.

Project coverage is 96.42%. Comparing base (56ccf57) to head (c3000d5).
Report is 54 commits behind head on develop.

Files with missing lines Patch % Lines
pyrealm/pmodel/pmodel_environment.py 74.07% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #412      +/-   ##
===========================================
+ Coverage    96.27%   96.42%   +0.15%     
===========================================
  Files           34       36       +2     
  Lines         2659     2744      +85     
===========================================
+ Hits          2560     2646      +86     
+ Misses          99       98       -1     

☔ 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.

Two small suggestions

pyrealm/pmodel/pmodel_environment.py Show resolved Hide resolved
pyrealm/pmodel/quantum_yield.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

Centralise data inputs to PModel in PModelEnvironment
3 participants