Alignment to dev - #43
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Addressed
Introduces a shared
BasePhysicsModelinterface for HBV models, deduplicating repeated code and adding new opt-in Hbv_2 features, plus fixes for regressions the refactor introduced.Description
hydrodl2.models.base.BasePhysicsModeland shared helpers incore/calc/utils.py(e.g.trim_warmup);hbv.py,hbv_1_1p.py,hbv_2.py,hbv_2_hourly.pynow subclass it, removing large amounts of duplicated boilerplate across the four models.hbv_2.py: added opt-in flagselev_parTT(elevation-based parTT override),gage_agg(in-loop gage-level aggregation),all_output, and an optionalrouting_statecarryover input.hbv_2_hourly.py: sameBasePhysicsModel/trim_warmuprefactor; removed deadself.initializebranch.api/methods.py:load_model()now also tries a PascalCase name conversion (e.g.hbv_adj->HbvAdj) before falling back to the first class found in the module.hydrodl2_masterand againstdmg's test suite:load_model()'s fallback could resolve to the wrong class (e.g.BasePhysicsModelitself, or an unrelated imported Hbv variant) once modules started importingBasePhysicsModel/other classes. Fixed by adding a case-insensitive name-match step and restricting the last-resort fallback to classes actually defined in the target module.elev_threshold(replacingelev_parTT) default wasFalse, silently dropping the original model's always-on elevation-based parTT override with no config anywhere setting the key. Reverted default toTrue.hbv_2.py/hbv_2_hourly.py:SLZlateral-flow clamp floor raised frommin=0.0tomin=self.nearzero—min=0.0letsSLZcollapse to exactly 0 for some parameter draws, permanently zeroing capillary rise and, in one observed case (dmg's test config), producing an all-zero/dead streamflow output.tests/test_model_structure.py:load_model()identity checks for all loadable HBV variants, and an explicit default-flag check for Hbv_2 (elev_parTT/gage_agg/all_output) so a future default flip fails immediately instead of surfacing only as a numeric drift.Type of Change
Other (please specify):
Checklist