Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

climetlab is not numpy 2 compliant (numpy.NaN is deprecated) #70

Open
thebaptiste opened this issue Nov 22, 2024 · 0 comments · May be fixed by #71
Open

climetlab is not numpy 2 compliant (numpy.NaN is deprecated) #70

thebaptiste opened this issue Nov 22, 2024 · 0 comments · May be fixed by #71
Labels
bug Something isn't working

Comments

@thebaptiste
Copy link

What happened?

I tried to use climetlab with numpy 2.0.2 on Python 3.12
import climetlab fails because numpy.NaN is used in hurricane_database.py
I used release 0.20.1 but it would have been the same with more recent releases as this is not fixed (I couldn't use 0.24.0 because of issue #69)

What are the steps to reproduce the bug?

Build climetlab from sources with numpy 2.0.2
Then use it with a program using hurricane_database.py

Version

v0.20.1

Platform (OS and architecture)

RockyLinux 8

Relevant log output

`  File "/src/integration_tests/0010_climetlab/climetlab_test.py", line 6, in <module>
    atlantic = cml.load_dataset("hurricane-database", bassin="atlantic")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/metwork-mfext-experimental_numpy2/opt/python3_scientific/lib/python3.12/site-packages/climetlab/datasets/__init__.py", line 280, in load_dataset
    ds = klass(*args, **kwargs).mutate()
         ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/metwork-mfext-experimental_numpy2/opt/python3_scientific/lib/python3.12/site-packages/climetlab/core/__init__.py", line 25, in __call__
    obj.__init__(*args, **kwargs)
  File "/opt/metwork-mfext-experimental_numpy2/opt/python3_scientific/lib/python3.12/site-packages/climetlab/datasets/hurricane_database.py", line 101, in __init__
    pressure = np.NaN if line[43] == "-" else float(line[43:47])
               ^^^^^^
  File "/opt/metwork-mfext-experimental_numpy2/opt/python3_scientific/lib/python3.12/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.NaN` was removed in the NumPy 2.0 release. Use `np.nan` instead.. Did you mean: 'nan'?``

Accompanying data

No response

Organisation

Meteo-France

@thebaptiste thebaptiste added the bug Something isn't working label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant