Skip to content

Add effective saturation calculation to hydrology tools#881

Merged
jacobcook1995 merged 4 commits intodevelopfrom
770-function-to-calculate-the-effective-saturation-should-be-moved-to-hydrology-tools
Jun 4, 2025
Merged

Add effective saturation calculation to hydrology tools#881
jacobcook1995 merged 4 commits intodevelopfrom
770-function-to-calculate-the-effective-saturation-should-be-moved-to-hydrology-tools

Conversation

@jacobcook1995
Copy link
Copy Markdown
Collaborator

Description

The effective saturation calculation has now been added as a function in hydrology tools, so that the hydrology model and the soil model use the same calculation.

The soil model now uses soil_moisture_saturation and soil_moisture_saturation from HydroConsts rather than soil_moisture_capacity from CoreConsts which should unblock #880

I also changed the core testing to use the litter model as a test case rather than the soil model. This has been annoying me for a while, and I reached breaking point so switching the testing to use the simpler model.

Fixes #770

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 Jun 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.80%. Comparing base (58dcd8f) to head (f3d12f3).
⚠️ Report is 1990 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #881   +/-   ##
========================================
  Coverage    94.79%   94.80%           
========================================
  Files           75       75           
  Lines         5590     5597    +7     
========================================
+ Hits          5299     5306    +7     
  Misses         291      291           

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

Comment thread tests/conftest.py
top_soil_layer_thickness: Thickness of the topsoil layer [mm].
soil_moisture_saturation: The :term:`soil moisture saturation` [unitless].
soil_moisture_residual: The :term:`soil moisture residual` [unitless].
top_soil_layer_thickness: Thickness of the topsoil layer [m].
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.

nice use of glossary here :-)

)

# Load hydrology constants
hydro_constants = load_constants(config, "hydrology", "HydroConsts")
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.

This looks like a neat solution to the different constants, I should adopt this to my models...

Copy link
Copy Markdown
Collaborator

@vgro vgro left a comment

Choose a reason for hiding this comment

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

LGTM

…aturation-should-be-moved-to-hydrology-tools
@jacobcook1995 jacobcook1995 merged commit 5e3ceef into develop Jun 4, 2025
16 checks passed
@jacobcook1995 jacobcook1995 deleted the 770-function-to-calculate-the-effective-saturation-should-be-moved-to-hydrology-tools branch June 4, 2025 12:01
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.

function to calculate the effective saturation should be moved to hydrology tools

3 participants