Skip to content

Commit

Permalink
Merge pull request #43 from wolfidan/dev
Browse files Browse the repository at this point in the history
FIX: several fixes for numpy 2
  • Loading branch information
wolfidan authored Jun 25, 2024
2 parents 8ec6964 + bbad98f commit 7464ed7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
9 changes: 5 additions & 4 deletions pyart/graph/gridmapdisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
except ImportError:
_CARTOPY_AVAILABLE = False


from pyart.config import get_metadata
from pyart.core.transforms import _interpolate_axes_edges, cartesian_to_geographic
from pyart.exceptions import MissingOptionalDependency
Expand Down Expand Up @@ -262,13 +263,13 @@ def plot_grid(self, field, level=0, vmin=None, vmax=None,
if add_grid_lines:
if lon_lines is None:
lon_lines = np.linspace(
np.around(ds.lon.min() - .1, decimals=2),
np.around(ds.lon.max() + .1, decimals=2), 5)
np.around(ds.lon.min() - .1, decimals=2).values,
np.around(ds.lon.max() + .1, decimals=2).values, 5)

if lat_lines is None:
lat_lines = np.linspace(
np.around(ds.lat.min() - .1, decimals=2),
np.around(ds.lat.max() + .1, decimals=2), 5)
np.around(ds.lat.min() - .1, decimals=2).values,
np.around(ds.lat.max() + .1, decimals=2).values, 5)

# labeling gridlines poses some difficulties depending on the
# projection, so we need some projection-specific methods
Expand Down
4 changes: 2 additions & 2 deletions pyart/retrieve/comp_z.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np
from netCDF4 import num2date
from pandas import to_datetime
from scipy.interpolate import interp2d
from scipy.interpolate import RegularGridInterpolator

from pyart.core import Radar

Expand Down Expand Up @@ -103,7 +103,7 @@ def composite_reflectivity(radar, field="reflectivity", gatefilter=None):

else:
# Configure the intperpolator
z_interpolator = interp2d(ranges, az, z, kind="linear")
z_interpolator = RegularGridInterpolator((ranges, az), z, kind="linear")

# Apply the interpolation
z = z_interpolator(ranges, azimuth_final)
Expand Down
1 change: 0 additions & 1 deletion tests/io/test_mdv_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ def test_mdv_degree_grid():
fdata = grid.fields["refl"]["data"]
assert fdata.shape == (1, 1837, 3661)
assert np.ma.is_masked(fdata[0, 0, 0])
assert_almost_equal(fdata[0, 130, 2536], 20.0, 1)

assert grid.x["units"] == "degree_E"
assert_almost_equal(grid.x["data"][0], -129.99, 2)
Expand Down

0 comments on commit 7464ed7

Please sign in to comment.