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

Merged
merged 14 commits into from
Feb 7, 2025

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 80.00000% with 7 lines in your changes missing coverage. Please review.

Please upload report for BASE (383-meta-release-200@c642de6). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pyrealm/pmodel/pmodel_environment.py 74.07% 7 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##             383-meta-release-200     #412   +/-   ##
=======================================================
  Coverage                        ?   96.42%           
=======================================================
  Files                           ?       36           
  Lines                           ?     2744           
  Branches                        ?        0           
=======================================================
  Hits                            ?     2646           
  Misses                          ?       98           
  Partials                        ?        0           

☔ 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

@davidorme davidorme changed the base branch from develop to 383-meta-release-200 February 7, 2025 10:52
@davidorme davidorme merged commit 305a824 into 383-meta-release-200 Feb 7, 2025
13 checks passed
@davidorme davidorme deleted the 390-update-pmodelenvironment branch February 7, 2025 11:52
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.

Centralise data inputs to PModel in PModelEnvironment
4 participants