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

soil evaporation constraint #318

Merged
merged 2 commits into from
Sep 28, 2023
Merged

soil evaporation constraint #318

merged 2 commits into from
Sep 28, 2023

Conversation

vgro
Copy link
Collaborator

@vgro vgro commented Sep 27, 2023

This PR makes sure that soil moisture does not fall below residual soil moisture. This was likely the cause of this error occurring during vr_run :

path/virtual_rainforest/virtual_rainforest/models/hydrology/below_ground.py:79: RuntimeWarning: invalid value encountered in sqrt* np.sqrt(effective_saturation)

I didn't add a specific test or warning message.

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

@vgro vgro requested a review from davidorme September 27, 2023 12:25
Copy link
Collaborator

@davidorme davidorme left a comment

Choose a reason for hiding this comment

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

LGTM - does that change in the test catch the case where the evaporation is constrained not to push SM below RSM? Might be useful to note that?

@codecov-commenter
Copy link

Codecov Report

Merging #318 (9ff3727) into develop (10afe8a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop     #318   +/-   ##
========================================
  Coverage    96.50%   96.50%           
========================================
  Files           48       48           
  Lines         2372     2376    +4     
========================================
+ Hits          2289     2293    +4     
  Misses          83       83           
Files Coverage Δ
...irtual_rainforest/models/hydrology/above_ground.py 100.00% <100.00%> (ø)
...ual_rainforest/models/hydrology/hydrology_model.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@vgro
Copy link
Collaborator Author

vgro commented Sep 28, 2023

LGTM - does that change in the test catch the case where the evaporation is constrained not to push SM below RSM? Might be useful to note that?

It didn't because I made the change in the update function. I added the clip to the function that calculates evaporation so I can test for it and it looks like it works ok.

@vgro vgro merged commit 78b18b5 into develop Sep 28, 2023
@vgro vgro deleted the bugfix/soil_moisture_positive branch September 28, 2023 08:25
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