File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,6 @@ def cutout_mask(
151
151
):
152
152
"""Return a mask for the points in [global_lats, global_lons] that are inside of [lats, lons]"""
153
153
from scipy .spatial import KDTree
154
- from scipy .spatial import distance_matrix
155
154
156
155
# TODO: transform min_distance from lat/lon to xyz
157
156
@@ -198,9 +197,8 @@ def cutout_mask(
198
197
if min_distance_km is not None :
199
198
min_distance = min_distance_km / 6371.0
200
199
else :
201
- min_distance = 0
202
- dm = distance_matrix (global_points , global_points )
203
- min_distance = np .min (dm [dm > 0 ])
200
+ distances , _ = KDTree (global_points ).query (global_points , k = 2 )
201
+ min_distance = np .min (distances [:, 1 ])
204
202
205
203
LOG .debug (f"cutout_mask using min_distance = { min_distance * 6371.0 } km" )
206
204
You can’t perform that action at this time.
0 commit comments