Skip to content

[#441] Fix freezing precipitation handling with --no-snow - #442

Open
ANAMASGARD wants to merge 4 commits into
PecanProject:masterfrom
ANAMASGARD:fix/441-no-snow-precipitation
Open

ANAMASGARD wants to merge 4 commits into
PecanProject:masterfrom
ANAMASGARD:fix/441-no-snow-precipitation

Conversation

@ANAMASGARD

Copy link
Copy Markdown
Contributor

Summary

  • What: Require snow tracking to be enabled before treating precipitation at or below 0 °C as snowfall. Add CLI regression coverage for −5 °C, 0 °C, and +5 °C with both snow settings, integrated into make test.
  • Motivation: --no-snow should treat all precipitation as liquid, as documented. Previously, freezing precipitation still entered the snowpack instead of reaching the soil. Snow-enabled behavior remains unchanged.

How was this change tested?

  • Clean application and test build passed without compiler warnings or errors.
  • All 32 C test executables passed through both make unit and make testrun.
  • All six CLI regression cases passed, checking the effective snow setting and both water pools.
  • All 30 Python tests passed.
  • Four active smoke fixtures passed in normal and debug modes. Runs used temporary copies and direct output comparisons instead of the Git-based smoke wrapper. The existing russell_4 skip was retained.
  • Complete outputs remained unchanged for all three snow-enabled controls and the warm --no-snow control.
  • Documentation built successfully; remaining warnings also reproduced on the pre-fix source.
  • The commit’s clang-format pre-commit check passed.

No smoke reference outputs were changed.

Reproduction steps

Run the new regression test:

make cli

The test starts with 3 cm of soil water, an empty snowpack, and 10 mm of precipitation. With --no-snow, soil water should reach 4 cm and snow should remain zero at all three temperatures.

Before the fix, the −5 °C and 0 °C cases instead ended with 3 cm of soil water and 1 cm of snow. With --snow, those cases continue to produce snow as expected.

Related issues

Checklist

  • Related issues are listed above; --no-snow still sends freezing precipitation to the snowpack #441 was assigned and the implementation plan approved.
  • PR title has the issue number in it.
  • Tests added/updated for new features (if applicable).
  • Documentation updated (if applicable): no user-guide change needed; the fix restores the documented behavior.
  • docs/CHANGELOG.md updated with noteworthy changes.
  • Code formatted with clang-format; the pre-commit formatting check passed.

Leave the changelog box unchecked—it was not updated in this commit.

Respect the snow flag when partitioning freezing precipitation. Add CLI regression coverage at -5, 0, and 5 C with both snow settings, and run it through make test.

Fixes PecanProject#441

Signed-off-by: Gaurav Chaudhary <chaudharygaurav2004@gmail.com>
@ANAMASGARD
ANAMASGARD marked this pull request as ready for review November 17, 2026 16:58
Copilot AI balanced review requested due to automatic review settings November 17, 2026 16:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the change that routes all precipitation as rain when snow tracking is disabled.

No open issues 🎉

Review effort: Balanced

@Alomir Alomir left a comment

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.

As stated in my other comment, please redo the test for this change. The change itself looks good - and thanks! - but needs a much more focused test.

Comment thread tests/cli/test_snow.sh Outdated
@@ -0,0 +1,56 @@
#!/usr/bin/env bash

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'm sorry to say this, but this change does not warrant a new category of testing. A much smaller focused test in the unit test subdirectories (maybe test_modeling?) should be sufficient.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Alomir Thanks for the feedback! I replaced the CLI test with a small, focused test in test_modeling and removed the extra Makefile target. It covers −5, 0, and 5 °C with snow enabled and disabled. All local build, test, and lint checks passed.

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.

Awesome, thanks!

Test precipitation partitioning directly in testFluxCalculations at -5, 0, and 5 C with snow enabled and disabled. Remove the separate CLI test and Makefile target so coverage uses the existing unit-test workflow.

Signed-off-by: Gaurav Chaudhary <chaudharygaurav2004@gmail.com>
@ANAMASGARD
ANAMASGARD requested a review from Alomir November 25, 2026 18:16

@Alomir Alomir left a comment

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.

Looks great, thanks a bunch!

@ANAMASGARD

Copy link
Copy Markdown
Contributor Author

@Alomir Thank you so much for the review. As you can see, all the tests have passed on the GitHub actions CI, so please, can you, if you feel right, merge this PR, because there are other PRs that I want to raise for issues I have been assigned to, but because of the three PR only restriction on repositories, I am not able to open a PR. So my humble request is, please, if you think that this PR is ready to be merged.

@ANAMASGARD
ANAMASGARD requested a review from Alomir November 30, 2026 17:22

This branch has not been deployed

No deployments
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.

--no-snow still sends freezing precipitation to the snowpack

3 participants