Skip to content
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
4 changes: 2 additions & 2 deletions src/metpy/calc/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions src/metpy/interpolate/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import math

import numpy as np
from scipy.spatial import cKDTree
from scipy.spatial import KDTree

log = logging.getLogger(__name__)

Expand All @@ -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

Expand All @@ -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])

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/metpy/interpolate/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'):
Expand Down