diff --git a/src/metpy/calc/tools.py b/src/metpy/calc/tools.py index 091545d885..4f856184b6 100644 --- a/src/metpy/calc/tools.py +++ b/src/metpy/calc/tools.py @@ -17,7 +17,7 @@ import numpy.ma as ma from pyproj import CRS, Geod, Proj -from scipy.spatial import cKDTree +from scipy.spatial import KDTree import xarray as xr from .. import _warnings @@ -300,7 +300,7 @@ def reduce_point_density(points, radius, priority=None): points = np.where(good_vals, points, 0) # Make a kd-tree to speed searching of data. - tree = cKDTree(points) + tree = KDTree(points) # Need to use sorted indices rather than sorting the position # so that the keep mask matches *original* order. diff --git a/src/metpy/interpolate/geometry.py b/src/metpy/interpolate/geometry.py index f91f1143cd..89f8e8f7a9 100644 --- a/src/metpy/interpolate/geometry.py +++ b/src/metpy/interpolate/geometry.py @@ -7,7 +7,7 @@ import math import numpy as np -from scipy.spatial import cKDTree +from scipy.spatial import KDTree log = logging.getLogger(__name__) @@ -33,7 +33,7 @@ def get_points_within_r(center_points, target_points, r): order as, center_points """ - tree = cKDTree(target_points) + tree = KDTree(target_points) indices = tree.query_ball_point(center_points, r) return tree.data[indices].T @@ -59,7 +59,7 @@ def get_point_count_within_r(center_points, target_points, r): order as, center_points """ - tree = cKDTree(target_points) + tree = KDTree(target_points) indices = tree.query_ball_point(center_points, r) return np.array([len(x) for x in indices]) @@ -255,7 +255,7 @@ def find_natural_neighbors(tri, grid_points): """ # Used for fast identification of points with a radius of another point - tree = cKDTree(grid_points) + tree = KDTree(grid_points) # Mask for points that are outside the triangulation in_triangulation = tri.find_simplex(tree.data) >= 0 diff --git a/src/metpy/interpolate/points.py b/src/metpy/interpolate/points.py index 216c054529..8bf7a0adf5 100644 --- a/src/metpy/interpolate/points.py +++ b/src/metpy/interpolate/points.py @@ -8,7 +8,7 @@ import numpy as np from scipy.interpolate import griddata, Rbf -from scipy.spatial import cKDTree, ConvexHull, Delaunay, QhullError +from scipy.spatial import ConvexHull, Delaunay, KDTree, QhullError from . import geometry, tools from ..package_tools import Exporter @@ -260,7 +260,7 @@ def inverse_distance_to_points(points, values, xi, r, gamma=None, kappa=None, mi else: raise ValueError(f'{kind} interpolation not supported.') - obs_tree = cKDTree(points) + obs_tree = KDTree(points) indices = obs_tree.query_ball_point(xi, r=r) if hasattr(values, 'units'):