USNavalResearchLaboratory / eispac

Read the Docs
https://eispac.readthedocs.io/en/latest/
MIT License
23 stars 6 forks source link

Compatibility with numpy 2.0 issue (removal of np.unicode_) #93

Closed andyto1234 closed 4 months ago

andyto1234 commented 4 months ago

Not sure if this should be raised here...

File [~/miniconda3/envs/solar/lib/python3.11/site-packages/eispac/core/read_cube.py:144](http://localhost:8889/lab/tree/~/miniconda3/envs/solar/lib/python3.11/site-packages/eispac/core/read_cube.py#line=143), in read_cube(filename, window, apply_radcal, radcal, abs_errs, count_offset, debug)
    142 val = np.array(f_head['index[/](http://localhost:8889/)'+key])
    143 if type(val[0]) == np.bytes_:
--> 144     val = val.astype(np.unicode_) # convert bytes to unicode
    145 if val.size == 1:
    146     val = val[0]

File [~/miniconda3/envs/solar/lib/python3.11/site-packages/numpy/__init__.py:397](http://localhost:8889/lab/tree/~/miniconda3/envs/solar/lib/python3.11/site-packages/numpy/__init__.py#line=396), in __getattr__(attr)
    394     raise AttributeError(__former_attrs__[attr])
    396 if attr in __expired_attributes__:
--> 397     raise AttributeError(
    398         f"`np.{attr}` was removed in the NumPy 2.0 release. "
    399         f"{__expired_attributes__[attr]}"
    400     )
    402 if attr == "chararray":
    403     warnings.warn(
    404         "`np.chararray` is deprecated and will be removed from "
    405         "the main namespace in the future. Use an array with a string "
    406         "or bytes dtype instead.", DeprecationWarning, stacklevel=2)

AttributeError: `np.unicode_` was removed in the NumPy 2.0 release. Use `np.str_` instead.
MJWeberg commented 4 months ago

Thanks for the heads-up, Andy! I have fixed this issue here on GitHub and will push an updated package to PyPI sometime soon.