From 4f5e69dc266e9184c6263c9a3da4abc571baeca1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 22:08:00 +0000 Subject: [PATCH 1/4] MNT: (deps): Bump numpy from 1.26.0 to 2.1.3 in /ci Bumps [numpy](https://github.com/numpy/numpy) from 1.26.0 to 2.1.3. - [Release notes](https://github.com/numpy/numpy/releases) - [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst) - [Commits](https://github.com/numpy/numpy/compare/v1.26.0...v2.1.3) --- updated-dependencies: - dependency-name: numpy dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- ci/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements.txt b/ci/requirements.txt index 1b6ea164d..2892569be 100644 --- a/ci/requirements.txt +++ b/ci/requirements.txt @@ -1,5 +1,5 @@ beautifulsoup4==4.12.3 -numpy==1.26.0 +numpy==2.1.3 pandas==2.2.3 protobuf==5.28.2 requests==2.28.1 From 6b3abd53705dbfda1c4b116d7180a487c355fe90 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Wed, 6 Nov 2024 15:15:18 -0700 Subject: [PATCH 2/4] CI: Bump to Cartopy 0.24 Needed to run with NumPy 2.x. --- ci/doc_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/doc_requirements.txt b/ci/doc_requirements.txt index 1698e3e9b..2b02c00e9 100644 --- a/ci/doc_requirements.txt +++ b/ci/doc_requirements.txt @@ -1,4 +1,4 @@ -cartopy==0.22 +cartopy==0.24 matplotlib==3.9.2 metpy==1.6.3 sphinx==5.2.3 From e5f12e01dd49f0dda156b3ca65f12b13aa9b91a1 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Wed, 6 Nov 2024 15:19:58 -0700 Subject: [PATCH 3/4] MNT: Bump minimum pandas to 1.4.3 This moves to the 1.4.x series to keep pace with MetPy, but needs 1.4.3 to fix a bug with read_fwf(). --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 601b92b14..4d538814d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ requires-python = ">=3.10" dependencies = [ "beautifulsoup4>=4.9.1", "numpy>=1.22.0", - "pandas>=1.3.4", + "pandas>=1.4.3", "protobuf>=3.20.0", "requests>=2.28.1" ] From d763a5a9a6c86abf1fd792fae0668d08ad9c5cdb Mon Sep 17 00:00:00 2001 From: Ryan May Date: Wed, 6 Nov 2024 15:29:15 -0700 Subject: [PATCH 4/4] MNT: Fix up genfromtxt on numpy 2 Numpy is returning strings rather than bytes, so we don't always need to decode. --- src/siphon/ncss.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/siphon/ncss.py b/src/siphon/ncss.py index b30fde1a6..abc762757 100644 --- a/src/siphon/ncss.py +++ b/src/siphon/ncss.py @@ -426,12 +426,20 @@ def parse_csv_header(line): return names, units +# Only needed until we support only numpy >= 2.0. +def _decode_if_needed(s): + try: + return s.decode('utf-8') + except AttributeError: + return s + + def parse_csv_dataset(data, handle_units): """Parse CSV data into a netCDF-like dataset.""" fobj = BytesIO(data) names, units = parse_csv_header(fobj.readline().decode('utf-8')) arrs = np.genfromtxt(fobj, dtype=None, names=names, delimiter=',', - converters={'date': lambda s: parse_iso_date(s.decode('utf-8'))}) + converters={'date': lambda s: parse_iso_date(_decode_if_needed(s))}) d = {} for f in arrs.dtype.fields: dat = arrs[f]