matplotlib / cmocean

Colormap setup for standardizing commonly-plotting oceanographic variables.
MIT License
230 stars 52 forks source link

numpy v2.0 compatibility #98

Closed MatthewFlamm closed 9 months ago

MatthewFlamm commented 9 months ago

When testing with this package as a dependency and numpy 2.0 dev version, I'm getting the following error:

[rest of log shortened]
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/cmocean/tools.py:12: in <module>
    _string_types = (str, np.str_, np.unicode_)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/numpy/__init__.py:396: in __getattr__
    raise AttributeError(
E   AttributeError: `np.unicode_` was removed in the NumPy 2.0 release. Use `np.str_` instead.

Can the np.unicode_ be removed in these lines?

https://github.com/matplotlib/cmocean/blob/4b627ffb41d6badf8316fb67700fdd5b91597432/cmocean/tools.py#L11-L14