pysat / pysatCDF

Python reader for NASA CDF file format
BSD 3-Clause "New" or "Revised" License
10 stars 7 forks source link

MAINT: numpy 1.24 compliance #46

Open jklenzing opened 1 year ago

jklenzing commented 1 year ago

Description

numpy 1.24 has dropped some deprecated features, in particular with respect to data access.

Potential impact

From unit tests for pandas data in pysatNASA:

>                   self.meta[var_name][attr_name] = data[i, 0:num_e]
E                   IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/pysatCDF/_cdf.py:572: IndexError

These errors do not appear when a version cap is applied.

Potential solution(s)

Update data standards.

Alternatives

😴

Additional context

Found in Github Actions testing. https://github.com/pysat/pysatNASA/actions/runs/3750994468/jobs/6371429123

rstoneback commented 1 year ago

Thanks for the report.

jklenzing commented 1 year ago

Validated that the same failure documented above appears in the unit tests here for develop-3 with numpy 1.24.1 in github actions. https://github.com/pysat/pysatCDF/actions/runs/3850046149/jobs/6559747390

jklenzing commented 1 year ago

Since I can't test this locally, I took a wild guess that it was a chained index issue and tried to update the broken lines to

self.meta[var_name][attr_name] = data[i][0:num_e]

Verified the unit tests work for numpy 1.24.1. PR incoming.