Skip to content

Commit c3e9895

Browse files
committed
Use legacy printing
NumPy 2.0 prints scalars as np.float(0.0). This reverts to (0.0) for the time being. Solves #261
1 parent f52c4cb commit c3e9895

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/pygrib/_pygrib.pyx

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ from numpy import ma
1515
import pyproj
1616
npc.import_array()
1717

18+
# Print scalars legacy style (e.g. (15.0) not np.float64(15.0))
19+
# https://numpy.org/doc/2.2/release/2.0.0-notes.html#representation-of-numpy-scalars-changed
20+
if np.lib.NumpyVersion(np.__version__) >= '2.0.0':
21+
np.set_printoptions(legacy="1.25")
22+
1823
ctypedef fused float_type:
1924
float
2025
double

0 commit comments

Comments
 (0)