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

fix:numpy 2.2.2 type compatibility issue #2616

Merged
merged 8 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions localbuild/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ requirements:
- flask-login
- pysaml2
- libxmlsec1 # [not win]
- numpy >= 2.0
run_constrained:
- menuinst >=2.0.2

Expand Down
2 changes: 1 addition & 1 deletion mslib/msui/mpl_pathinteractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def insert_vertex(self, index, vertex, code):
matplotlib.Path) at the given index.
"""
self.vertices = np.insert(self.vertices, index,
np.asarray(vertex, np.float_), axis=0)
np.asarray(vertex, np.float64), axis=0)
self.codes = np.insert(self.codes, index, code, axis=0)

def index_of_closest_segment(self, x, y, eps=5):
Expand Down
2 changes: 1 addition & 1 deletion mslib/mswms/demodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ def generate_file(self, coordinate, label, leveltype, dimvals, variables):
newvar.units = unit
newvar[:] = test_data
newvar.grid_mapping = 'LatLon_Projection'
newvar.missing_value = float('nan')
newvar.missing_value = np.nan

ecmwf.close()

Expand Down
2 changes: 1 addition & 1 deletion mslib/utils/thermolib.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def omega_to_w(omega, p, t):
(32 * units.km, 228.65 * units.K, 868.019 * units.Pa, -0.0028 * units.K / units.m),
(47 * units.km, 270.65 * units.K, 110.906 * units.Pa, 0 * units.K / units.m),
(51 * units.km, 270.65 * units.K, 66.9389 * units.Pa, 0.0028 * units.K / units.m),
(71 * units.km, 214.65 * units.K, 3.95642 * units.Pa, float("NaN") * units.K / units.m)
(71 * units.km, 214.65 * units.K, 3.95642 * units.Pa, np.nan * units.K / units.m)
Copy link
Member

@ReimarBauer ReimarBauer Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally recommended is to use np.nan when working with NumPy arrays and float("NaN") when working with built-in Python types.

This is likly the reason why May has used float("NaN") here.

It is not the only place where we have the string notation. When that gets changed then always.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think float("NaN") is used only once in the develop branch.
Do I need to revert back the change in this file ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you maybe need to do a regex lookup, I think I mentioned on slack, demodata

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I asked @joernu76 about the changes here, but no answer to that question yet.

]
_HEIGHT, _TEMPERATURE, _PRESSURE, _TEMPERATURE_GRADIENT = 0, 1, 2, 3

Expand Down
Loading