Skip to content

Commit

Permalink
Improved the _ravenpy_models.py script to be able to specify the rain…
Browse files Browse the repository at this point in the history
… snow fraction for all models (#215)

<!-- Please ensure the PR fulfills the following requirements! -->
<!-- If this is your first PR, make sure to add your details to the
AUTHORS.rst! -->
### Pull Request Checklist:
- [ ] This PR addresses an already opened issue (for bug fixes /
features)
  - This PR fixes #xyz
- [ ] (If applicable) Documentation has been added / updated (for bug
fixes / features).
- [ ] (If applicable) Tests have been added.
- [ ] CHANGELOG.rst has been updated (with summary of main changes).
- [ ] Link to issue (:issue:`number`) and pull request (:pull:`number`)
has been added.

### What kind of change does this PR introduce?

Improved the _ravenpy_models.py script to be able to specify the rain
snow fraction for all models, including HBVEC. With the new version of
RavenPy (v0.16.0, unreleased), the rain_snow_fraction could be set with
"RainSnowFraction=rain_snow_fraction" in the
self.default_emulator_config dictionary. See:
CSHS-CWRA/RavenPy#408. For now (based on the
latest release RavenPy version, v0.15.0) the change I'm suggesting here
will enable changing the rain snow fraction algorithm for HBVEC as well.

### Does this PR introduce a breaking change?

None foreseen.

### Other information:
  • Loading branch information
lou-a authored Oct 16, 2024
2 parents ecc4a49 + 895f73a commit c0186be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"name": "Arsenault, Richard",
"affiliation": "École de technologie supérieure, Montréal, Québec, Canada",
"orcid": "0000-0003-2834-2750"
},
{
"name": "Arnal, Louise",
"affiliation": "Ouranos",
"orcid": "0000-0002-0208-2324"
}
],
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ Contributors

* Richard Arsenault `@richardarsenault <https://github.com/richardarsenault>`_
* Francis Gravel `@mayetea <https://github.com/mayetea>`_
* Louise Arnal `@lou-a <https://github.com/lou-a>`_
5 changes: 1 addition & 4 deletions src/xhydro/modelling/_ravenpy_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def __init__(
data_kwds=meteo_station_properties,
)
],
RainSnowFraction=rain_snow_fraction,
rain_snow_fraction=rain_snow_fraction,
Evaporation=evaporation,
**kwargs,
)
Expand Down Expand Up @@ -152,9 +152,6 @@ def run(self) -> str | xr.Dataset:
if "qobs" in default_emulator_config:
default_emulator_config.pop("qobs")

if model_name == "HBVEC":
default_emulator_config.pop("RainSnowFraction")

self.model = getattr(ravenpy.config.emulators, model_name)(
**default_emulator_config
)
Expand Down

0 comments on commit c0186be

Please sign in to comment.