Skip to content

Commit 4c3e143

Browse files
authored
Partially enable RHF v4.0 evaluation metrics, stability/typing fixes (#476)
### What kind of change does this PR introduce? * Enables the new evaluation metrics introduced in RHF v4.0.0 * Adjusts the testing suite to verify more evaluation metrics * More clearly indicates the expected types in many call signatures and docstrings ### Does this PR introduce a breaking change? No. New functionality has been added.
2 parents 1c14e4c + 9852720 commit 4c3e143

32 files changed

+393
-349
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
include:
6666
- os: 'ubuntu-latest'
6767
python-version: '3.10'
68-
tox-env: 'py3.10-coveralls-upstream'
68+
tox-env: 'py3.10-coverage-upstream'
6969
steps:
7070
- name: Harden Runner
7171
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
@@ -122,7 +122,7 @@ jobs:
122122
if [ "${{ matrix.tox-env }}" != "false" ]; then
123123
python3 -m tox -e ${{ matrix.tox-env }}
124124
elif [ "${{ matrix.python-version }}" != "3.13" ]; then
125-
python3 -m tox -e py${{ matrix.python-version }}-coveralls
125+
python3 -m tox -e py${{ matrix.python-version }}-coverage
126126
else
127127
python3 -m tox -e py${{ matrix.python-version }}
128128
fi
@@ -197,6 +197,7 @@ jobs:
197197
parallel: true
198198

199199
finish:
200+
name: Finish
200201
needs:
201202
- pip
202203
- conda
@@ -206,7 +207,11 @@ jobs:
206207
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
207208
with:
208209
disable-sudo: true
209-
egress-policy: audit
210+
egress-policy: block
211+
allowed-endpoints: >
212+
coveralls.io:443
213+
github.com:443
214+
objects.githubusercontent.com:443
210215
- name: Coveralls Finished
211216
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
212217
with:

AUTHORS.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ Contributors
1919
------------
2020

2121
* Louise Arnal <arnal.louise@ouranos.ca> `@lou-a <https://github.com/lou-a>`_
22-
* Pascal Bourgault <bourgault.pascal@ouranos.ca> `@aulemahal <https://github.com/aulemaha>`_
22+
* Pascal Bourgault <bourgault.pascal@ouranos.ca> `@aulemahal <https://github.com/aulemahal>`_

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ Changelog
55
v0.18.0 (unreleased)
66
--------------------
77

8+
New features
9+
^^^^^^^^^^^^
810
* `ravenpy` now supports Python3.13. (PR #459)
911
* Updated `raven-hydro` to v0.4.0 (`RavenHydroFramework` v4.0.1). (PR #459)
1012
* Updated `xclim` to v0.54.0, `pint` to v0.24.4, and `numpy` to v1.24.0 (no longer pinned below v2.0). (PR #459)
1113
* `ravenpy` is now registered with the Open Source Security Foundation (OSSF) Best Practices initiative (`RavenPy OpenSSF-BP Status <https://www.bestpractices.dev/en/projects/10064>`_). (PR #464)
14+
* `ravenpy` now enables new EvaluationMetrics commands in the model configuration. Other features from `RavenHydroFramework` will be included in newer releases. (PR #476)
1215

1316
Bug fixes
1417
^^^^^^^^^
@@ -25,6 +28,9 @@ Internal changes
2528
* Spelling errors in documentation have been addressed.
2629
* GitHub Workflows now test `ravenpy` using macOS as well as Python3.13. (PR #459)
2730
* Several small deprecation and usage warnings as well as a few variable typing issues have been addressed. (PR #464)
31+
* Updated the license to reflect current year. (PR #476)
32+
* Documentation version now supports showing hyphens in the version number. (PR #476)
33+
* Call signatures and docstrings of functions have been modified to be more precise for the expected variable type. (PR #476)
2834

2935
v0.17.0 (2025-01-27)
3036
--------------------

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020-2024 David Huard, Trevor James Smith, Christian Jauvin, Julie Mai, Ming Han
3+
Copyright (c) 2020-2025 David Huard, Trevor James Smith, Christian Jauvin, Julie Mai, Ming Han
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RavenPy |logo|
1515
+----------------------------+-----------------------------------------------------+
1616

1717

18-
A Python wrapper to setup and run the hydrologic modelling framework Raven_.
18+
A Python wrapper for configuring and running the hydrologic modelling framework Raven_.
1919

2020
* Free software: MIT license
2121
* Documentation: https://ravenpy.readthedocs.io

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def rebuild_readme():
170170
# the built documents.
171171
#
172172
# The short X.Y version.
173-
version = ravenpy.__version__
173+
version = ravenpy.__version__.split("-")[0]
174174
# The full version, including alpha/beta/rc tags.
175175
release = ravenpy.__version__
176176

environment-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424
- pint >=0.24.4
2525
- platformdirs >=4.3.6
2626
- pydantic >=2.0
27-
- pydap >=3.4.0
27+
- pydap >=3.4.0 # Note: As of 2025-03-18 (v3.5.4) does not support Python 3.13
2828
- pymetalink >=6.5.2
2929
- pymbolic >=2024.2
3030
- pyproj >=3.3.0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ dependencies = [
5050
"pint >=0.24.4",
5151
"platformdirs >=4.3.6",
5252
"pydantic >=2.0",
53-
"pydap >=3.4.0",
53+
"pydap >=3.4.0", # Note: As of 2025-03-18 (v3.5.4) does not support Python 3.13
5454
"pymbolic >=2024.2",
5555
"raven-hydro >=0.4.0,<1.0",
5656
"scipy >=1.11.0",

src/ravenpy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
"""A Python wrapper to setup and run the hydrologic modelling framework Raven."""
1+
"""A Python wrapper for configuring and running the hydrologic modelling framework Raven."""
22

33
###################################################################################
44
# MIT License
55
#
6-
# Copyright (c) 2020-2024 David Huard, Trevor James Smith, Christian Jauvin, Julie Mai, Ming Han
6+
# Copyright (c) 2020-2025 David Huard, Trevor James Smith, Christian Jauvin, Julie Mai, Ming Han
77
#
88
# Permission is hereby granted, free of charge, to any person obtaining a copy
99
# of this software and associated documentation files (the "Software"), to deal

src/ravenpy/cli/aggregate_forcings_to_hrus.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def aggregate_forcings_to_hrus(
6666
command will require.
6767
"""
6868
# NOTE: This is in order to make sphinx-click happy. Magic. Do not touch.
69-
import netCDF4 as nc4 # noqa: N813
69+
import netCDF4
7070
import numpy as np
7171

7272
gws = GridWeights.parse(Path(input_weight_file).read_text())
@@ -76,7 +76,7 @@ def aggregate_forcings_to_hrus(
7676
weights_data = gws.data
7777

7878
# read NetCDF
79-
nc_in = nc4.Dataset(input_nc_file, "r")
79+
nc_in = netCDF4.Dataset(input_nc_file, "r")
8080

8181
# length of dimensions
8282
nlon = nc_in.dimensions[dim_names[0]].size
@@ -107,7 +107,7 @@ def aggregate_forcings_to_hrus(
107107
else:
108108
output_nc_file_path = Path(output_nc_file)
109109

110-
nc_out = nc4.Dataset(output_nc_file_path, "w")
110+
nc_out = netCDF4.Dataset(output_nc_file_path, "w")
111111
_ = nc_out.createDimension("time", ntime)
112112
_ = nc_out.createDimension("nHRU", nHRU)
113113

0 commit comments

Comments
 (0)