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 nitrogen mineralisation #616

Merged
merged 19 commits into from
Nov 6, 2024

Conversation

jacobcook1995
Copy link
Collaborator

Description

This pull request adds two new pools to track nitrogen in the soil "soil_n_pool_don" and "soil_n_pool_particulate". These pools both receive input from litter mineralisation, and the DON (dissolved organic nitrogen) pool also leaches. Both pools are organic nitrogen pools, so effectively track the nitrogen stoichiometry of their corresponding carbon pools (the low molecular weight carbon (LMWC) pool and the particulate organic matter (POM) pool). The breakdown rate of POM to LMWC therefore determines the rate at which nitrogen goes from the particulate to the dissolved pool.

I've also tried to restructure the code a bit. I've added a new SoilPools class, which has method to calculate updates for all soil pools. I still feel like the contents of this method is a bit messy, but I couldn't see an obvious way to group the function steps that would make it clearer. I'm leaving this as is for now, but intended to refactor as further pools are added

Fixes #605

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

@jacobcook1995 jacobcook1995 linked an issue Oct 28, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 96.07843% with 2 lines in your changes missing coverage. Please review.

Project coverage is 95.16%. Comparing base (a7efd83) to head (06e6b61).
Report is 10 commits behind head on develop.

Files with missing lines Patch % Lines
...ample_data/generation_scripts/soil_example_data.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #616      +/-   ##
===========================================
- Coverage    95.18%   95.16%   -0.02%     
===========================================
  Files           74       74              
  Lines         4380     4409      +29     
===========================================
+ Hits          4169     4196      +27     
- Misses         211      213       +2     

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

I've made a couple of comments/suggestions, but it looks good, otherwise.

docs/source/_toc.yaml Outdated Show resolved Hide resolved
virtual_ecosystem/models/soil/all_pools.py Outdated Show resolved Hide resolved
virtual_ecosystem/models/soil/all_pools.py Outdated Show resolved Hide resolved
virtual_ecosystem/models/soil/all_pools.py Outdated Show resolved Hide resolved
virtual_ecosystem/models/soil/soil_model.py Outdated Show resolved Hide resolved
virtual_ecosystem/models/soil/soil_model.py Outdated Show resolved Hide resolved
@jacobcook1995
Copy link
Collaborator Author

jacobcook1995 commented Nov 5, 2024

@dalonsoa, I've tried to address all your suggestions. Let me know whether the changes look okay. Cheers!

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.

All looks good!

docs/source/_toc.yaml Outdated Show resolved Hide resolved
Co-authored-by: Diego Alonso Álvarez <[email protected]>
@jacobcook1995 jacobcook1995 merged commit 79d9635 into develop Nov 6, 2024
13 checks passed
@jacobcook1995 jacobcook1995 deleted the 605-soil-model-needs-to-track-organic-nitrogen branch November 6, 2024 08:42
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.

Soil model needs to track organic nitrogen
4 participants