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

Rework PModelConsts and usage in functions #435

Draft
wants to merge 20 commits into
base: 383-meta-release-200
Choose a base branch
from

Conversation

davidorme
Copy link
Collaborator

@davidorme davidorme commented Feb 19, 2025

Description

The PModelConsts object has a very disorganised namespace with a mix of bundled and individual parameters, and poor use of attribute docstrings to pair information with data.

Tip

This is a slightly sprawling PR because it restructures PModelConst - so lots of changes - but also updates the signatures of the pmodel functions. Most of the actual changes are in pmodel_const.py and pmodel/functions.py - everything else is just updates to match

  • Reviews the PModelConsts contents to group closely related parameters into single attributes with better documentation.
  • Adds tk_ref to avoid the omnipresent recalculation of this value through the code base, and renames plant_T_ref to tc_ref for consistency.
  • Updates the signatures of the pyrealm.pmodel.functions to take more specific parameterisation, rather than simply chucking all of PModelConst and CoreConst into each one. This makes the implementation and docs clearer.
  • Updates usage to match and updates tests.

Fixes #391

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 19, 2025 that may be closed by this pull request
@davidorme davidorme changed the base branch from develop to 383-meta-release-200 February 19, 2025 23:12
@codecov-commenter
Copy link

codecov-commenter commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@                   Coverage Diff                   @@
##             383-meta-release-200     #435   +/-   ##
=======================================================
  Coverage                        ?   96.72%           
=======================================================
  Files                           ?       35           
  Lines                           ?     2660           
  Branches                        ?        0           
=======================================================
  Hits                            ?     2573           
  Misses                          ?       87           
  Partials                        ?        0           

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

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

Successfully merging this pull request may close these issues.

Review the constants bundling in pyrealm.constants
2 participants