From 25c32f94dc9470c8580004c256cf917d4d01590b Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 17 Dec 2025 15:20:02 -0500 Subject: [PATCH 1/5] unpin pydantic, raise pin on pydap and h5netcdf Signed-off-by: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> --- environment-dev.yml | 5 +++-- environment-docs.yml | 2 +- pyproject.toml | 6 +++--- tests/test_utils.py | 1 - 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/environment-dev.yml b/environment-dev.yml index a71ccd7d..650f15e8 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -22,8 +22,8 @@ dependencies: - owslib >=0.29.1 - pandas >=2.2.0 - pint >=0.24.4 - - pydantic >=2.11,<2.12 - - pydap >=3.4.0,<3.5.5 # pydap 3.5.5 is not currently supported by `xarray` (v2025.3.1) + - pydantic >=2.11 + - pydap >=3.5.6 - pymetalink >=6.5.2 - pymbolic >=2024.2 - pyproj >=3.3.0 @@ -53,6 +53,7 @@ dependencies: - holoviews - hvplot - mypy >=1.18.2 + - nbval - numpydoc >=1.9.0 - pooch >=1.8.0 - pre-commit >=3.5.0 diff --git a/environment-docs.yml b/environment-docs.yml index 05cbb7e2..2b361388 100644 --- a/environment-docs.yml +++ b/environment-docs.yml @@ -12,7 +12,7 @@ dependencies: - clisops >=0.15.0 - gcsfs - gdal >=3.1 - - h5netcdf >=1.3.0 + - h5netcdf >=1.5.0 # Needed for notebooks/HydroShare_integration.ipynb # See: https://github.com/CSHS-CWRA/RavenPy/pull/326 # - "hsclient", diff --git a/pyproject.toml b/pyproject.toml index 1125aece..ff060b36 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,15 +42,15 @@ dependencies = [ "click >=8.2.0", "climpred >=2.4.0", "dask >=2024.8.1", - "h5netcdf >=1.3.0", + "h5netcdf >=1.5.0", "haversine >=2.8.0", "matplotlib >=3.6.0", "numpy >=1.25.0", "owslib >=0.29.1", "pandas >=2.2.0", "pint >=0.24.4", - "pydantic >=2.11,<2.12", - "pydap >=3.4.0,<3.5.5", # pydap 3.5.5 is not currently supported by `xarray` (v2025.3.1) + "pydantic >=2.11", + "pydap >=3.5.6", "pymbolic >=2024.2", "scipy >=1.11.0", "spotpy >=1.6.1", diff --git a/tests/test_utils.py b/tests/test_utils.py index ff7acd3e..a390b2c6 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -41,7 +41,6 @@ def test_nc_specs_bad(bad_netcdf): @pytest.mark.online -@pytest.mark.skipif(older_pydap, reason="pydap version 3.5.5 is required for this test", strict=False) def test_dap_specs(): # Link to THREDDS Data Server netCDF testdata tds = "https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/dodsC/birdhouse/testdata/raven" From fa032047b13c150e269857b1fc5f21534c961078 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 17 Dec 2025 15:20:45 -0500 Subject: [PATCH 2/5] small convention adjustment Signed-off-by: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> --- src/ravenpy/config/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ravenpy/config/utils.py b/src/ravenpy/config/utils.py index 259fb4ff..acfb1c28 100644 --- a/src/ravenpy/config/utils.py +++ b/src/ravenpy/config/utils.py @@ -84,7 +84,7 @@ def nc_specs( attrs["units"] = nc_var.attrs.get("units") if attrs["units"] is not None: s, o = infer_scale_and_offset(nc_var, data_type) - attrs["linear_transform"] = dict(scale=s, offset=o) + attrs["linear_transform"] = {"scale": s, "offset": o} if mon_ave: ma = MonthlyAverages.get(data_type) if ma: From 8a400c41e33d8d5e976b45d2c8f238992b544bd3 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 17 Dec 2025 15:32:27 -0500 Subject: [PATCH 3/5] update pre-commit, adress DeprecationWarning, update CHANGELOG.rst Signed-off-by: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> --- .pre-commit-config.yaml | 6 +++--- CHANGELOG.rst | 2 ++ src/ravenpy/ravenpy.py | 6 +----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index da636742..7205d8e9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,7 +49,7 @@ repos: - id: rst-inline-touching-normal - id: text-unicode-replacement-char - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.7 + rev: v0.14.9 hooks: - id: ruff-check args: [ '--fix', '--show-fixes' ] @@ -87,12 +87,12 @@ repos: additional_dependencies: [ 'tomli' ] args: [ '--toml=pyproject.toml' ] - repo: https://github.com/numpy/numpydoc - rev: v1.9.0 + rev: v1.10.0 hooks: - id: numpydoc-validation exclude: "^docs/|^tests/" - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.35.0 + rev: 0.36.0 hooks: - id: check-github-workflows - id: check-readthedocs diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d2261fc6..81770d0d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -23,6 +23,8 @@ Internal changes * Removed `black`, `blackdoc`, and `isort`, as well as their configurations. * Updated `pyproject.toml` to be `PEP 639 `_-compliant. * Pinned `pydantic` below v2.12 due to breaking changes in their API. (PR #548) + * Unpinned `pydantic` as newer 2.12 patch releases appear to have addressed regressions. +* Pinned `pydap` >=3.5.6 and `h5netcdf` >=1.5.0 to ensure modern versions with better `xarray` support are installed by default. .. _changes_0.19.1: diff --git a/src/ravenpy/ravenpy.py b/src/ravenpy/ravenpy.py index 932d165b..84b319b8 100644 --- a/src/ravenpy/ravenpy.py +++ b/src/ravenpy/ravenpy.py @@ -235,11 +235,7 @@ def storage(self): def hydrograph(self): if len(self.files["hydrograph"]) == 0: raise ValueError("No file found, make sure you have the right `run_name` and output `paths`.") - return xr.concat( - [xr.open_dataset(f) for f in self.files["hydrograph"]], - dim=self._dim, - coords="different", - ) + return xr.concat([xr.open_dataset(f) for f in self.files["hydrograph"]], dim=self._dim, coords="different", compat="equals") def run( From d9dbf6efac1ce409afeb95a9a237e5f89534bae4 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 17 Dec 2025 15:38:23 -0500 Subject: [PATCH 4/5] remove unneeded import Signed-off-by: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> --- tests/test_utils.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index a390b2c6..927634be 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,15 +1,8 @@ import pytest -from packaging.version import Version -from pydap import __version__ as __pydap_version__ from ravenpy.config.utils import nc_specs -older_pydap = False -if Version(__pydap_version__) < Version("3.5.5"): - older_pydap = True - - def test_nc_specs(yangtze): f = yangtze.fetch("raven-gr4j-cemaneige/Salmon-River-Near-Prince-George_meteo_daily.nc") attrs = nc_specs(f, "PRECIP", station_idx=1, alt_names=("rain",)) From 29eb6c78482c6f2d95cfa42499bb1fcd1a00bdcf Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 17 Dec 2025 15:49:18 -0500 Subject: [PATCH 5/5] update CHANGELOG.rst Signed-off-by: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> --- CHANGELOG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 81770d0d..93f8a48b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -23,8 +23,8 @@ Internal changes * Removed `black`, `blackdoc`, and `isort`, as well as their configurations. * Updated `pyproject.toml` to be `PEP 639 `_-compliant. * Pinned `pydantic` below v2.12 due to breaking changes in their API. (PR #548) - * Unpinned `pydantic` as newer 2.12 patch releases appear to have addressed regressions. -* Pinned `pydap` >=3.5.6 and `h5netcdf` >=1.5.0 to ensure modern versions with better `xarray` support are installed by default. + * Unpinned `pydantic` as newer 2.12 patch releases appear to have addressed regressions. (PR #559). +* Pinned `pydap` >=3.5.6 and `h5netcdf` >=1.5.0 to ensure modern versions with better `xarray` support are installed by default. (PR #559). .. _changes_0.19.1: