Skip to content

Unpin the update interval in hydrology#981

Merged
davidorme merged 10 commits intodevelopfrom
980-unpin-the-update-interval-in-hydrology
Aug 1, 2025
Merged

Unpin the update interval in hydrology#981
davidorme merged 10 commits intodevelopfrom
980-unpin-the-update-interval-in-hydrology

Conversation

@davidorme
Copy link
Copy Markdown
Collaborator

@davidorme davidorme commented Jul 31, 2025

Description

This PR:

  • Relaxes the hydrology model to allow intervals other than 30 days and adds code to calculate the actual number of days in the update interval. It warns when the update interval is not a whole number of days.
  • Updates the docs to describe the internal calculation.
  • Updates the tests - there was a test that using 1 week would fail - I've retained the 1 week test case but updated it to show that it works. The resulting test values seem sensible: the model gets the same precipitation in fewer days, so the vertical flow and runoff are higher, but there is less time for soil evaporation, which is lower.

There are also a couple of requires mypy fixes - the numpy plugin for mypy has been deprecated and the new system picks up a couple of things.

@jacobcook1995 There are a couple of weird typing things here from litter: two functions that claimed to return dict[str, NDArray] but didn't and hadn't been caught for some reason.

Fixes #980

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

@davidorme davidorme linked an issue Jul 31, 2025 that may be closed by this pull request
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.23%. Comparing base (5b2cc1b) to head (d9d13f3).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #981      +/-   ##
===========================================
- Coverage    94.23%   94.23%   -0.01%     
===========================================
  Files           79       79              
  Lines         6589     6587       -2     
===========================================
- Hits          6209     6207       -2     
  Misses         380      380              

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

@davidorme davidorme requested a review from vgro July 31, 2025 20:14
@davidorme davidorme requested a review from jacobcook1995 July 31, 2025 22:16
Copy link
Copy Markdown
Collaborator

@jacobcook1995 jacobcook1995 left a comment

Choose a reason for hiding this comment

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

LGTM! (Honestly really surprised that that litter model typing ever passed CI)

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!

Could you please delete the TODO in line 18 in hydrology_model.py

@davidorme davidorme merged commit 3df9e7a into develop Aug 1, 2025
16 checks passed
@davidorme davidorme deleted the 980-unpin-the-update-interval-in-hydrology branch August 1, 2025 10:54
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.

Unpin the update interval in hydrology

4 participants