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

Adding organic phosphorus flows #653

Merged
merged 10 commits into from
Jan 8, 2025
Merged

Conversation

jacobcook1995
Copy link
Collaborator

Description

This pull request adds organic flows of phosphorus to the soil model. This involved extending the functionality developed to track the organic nitrogen cycle to also track the organic phosphorus cycle. The scientific content is a bit dense here, but would be good to get feedback on the code structure/clarity.

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
  • Relevant documentation reviewed and updated

@codecov-commenter
Copy link

codecov-commenter commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 90.47619% with 4 lines in your changes missing coverage. Please review.

Project coverage is 94.57%. Comparing base (bf33499) to head (41d5f1b).
Report is 15 commits behind head on develop.

Files with missing lines Patch % Lines
...ample_data/generation_scripts/soil_example_data.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #653      +/-   ##
===========================================
- Coverage    94.63%   94.57%   -0.06%     
===========================================
  Files           73       73              
  Lines         4619     4645      +26     
===========================================
+ Hits          4371     4393      +22     
- Misses         248      252       +4     

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

Copy link
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

The code itself looks OK - it pretty much follows what nitrogen is doing, as far as I can tell.

However, I've seen that now there are several functions returning dictionaries rather than tuples that can be unpacked, which is less readable. I wonder if it would be better to create dataclasses, as it is done for MicrobialChanges, to contain those outputs.

The same might apply to pools, which is a very large dict and that could be more more readable if it were a dataclass.

None of this is a request for a change, just observations.

@jacobcook1995
Copy link
Collaborator Author

jacobcook1995 commented Jan 8, 2025

@dalonsoa yes I did wonder whether returning dataclasses rather than dictionaries would be better practice. Good to know!

The next thing I'm working on will be adding inorganic nitrogen and phosphorus pools in, which will involve altering some of functions added/changed here. With that in mind I will merge this now and switch outputs to dataclasses when I'm working on the new code

@jacobcook1995 jacobcook1995 merged commit 2bf6911 into develop Jan 8, 2025
13 checks passed
@jacobcook1995 jacobcook1995 deleted the feature/organic_phosphorus branch January 8, 2025 12:17
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.

3 participants