Skip to content

Commit

Permalink
Merge pull request #809 from Unidata/dependabot-pip-ci-numpy-2.1.3
Browse files Browse the repository at this point in the history
MNT: (deps): Bump numpy from 1.26.0 to 2.1.3 in /ci
  • Loading branch information
dcamron authored Nov 6, 2024
2 parents d7ee03a + d763a5a commit fe3dd77
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ci/doc_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cartopy==0.22
cartopy==0.24
matplotlib==3.9.2
metpy==1.6.3
sphinx==5.2.3
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down
10 changes: 9 additions & 1 deletion src/siphon/ncss.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit fe3dd77

Please sign in to comment.