Skip to content

Added nitrogen limitation for microbial growth#628

Merged
jacobcook1995 merged 13 commits intodevelopfrom
feature/microbial_nutrient_limitation
Dec 5, 2024
Merged

Added nitrogen limitation for microbial growth#628
jacobcook1995 merged 13 commits intodevelopfrom
feature/microbial_nutrient_limitation

Conversation

@jacobcook1995
Copy link
Copy Markdown
Collaborator

Description

This PR adds in nitrogen flows between the full set of soil carbon pools and adds nitrogen as a factor limiting microbial growth. The nitrogen content of the microbial biomass (and enzymes) is not explicitly tracked as microbial biomass is assumed to have fixed stoichiometry (which means it is already tracked implicitly).

This pull request basically just adds a few new variables and new functions to update them, there are not any significant structural changes. Let me know if you notice any areas needing improvement!

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
Copy Markdown

codecov-commenter commented Nov 29, 2024

Codecov Report

❌ Patch coverage is 96.15385% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.69%. Comparing base (8873031) to head (a3cbcc7).
⚠️ Report is 2974 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     #628   +/-   ##
========================================
  Coverage    94.69%   94.69%           
========================================
  Files           73       73           
  Lines         4541     4582   +41     
========================================
+ Hits          4300     4339   +39     
- Misses         241      243    +2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
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.

Just a couple of suggestions and questions, but looks good!

Comment on lines +881 to +892
def calculate_nutrient_flows_to_necromass(
microbial_changes: MicrobialChanges, constants: SoilConsts
) -> NDArray[np.float32]:
"""Calculate the rate at which nutrients flow into the necromass pool.

These flows comprise of the nitrogen and phosphorus content of the dead cells and
denatured enzymes that flow into the necromass pool.

TODO - A core assumption here is that the stochiometry of the enzymes are identical
to the microbial cells. This assumption works for now but will have to be revisited
when fungi are added (as they have different stochiometric ratios but will
contribute to the same enzyme pools)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess you have a separate function for this and the chosen inputs as there might be other, more complex stuff going on in the future in this function, right? Otherwise, this functions seems a bit overkilling for a simple division.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yep in future, the microbial pool will be separated into (at least) a bacterial pool and a fungal pool. These pools will have different stoichiometry which means the calculation will become more involved, so the function is basically a placeholder for when I will do this.

@jacobcook1995 jacobcook1995 merged commit 15352ab into develop Dec 5, 2024
@jacobcook1995 jacobcook1995 deleted the feature/microbial_nutrient_limitation branch December 5, 2024 10:06
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