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(
151151):
152152    """Return a mask for the points in [global_lats, global_lons] that are inside of [lats, lons]""" 
153153    from  scipy .spatial  import  KDTree 
154-     from  scipy .spatial  import  distance_matrix 
155154
156155    # TODO: transform min_distance from lat/lon to xyz 
157156
@@ -198,9 +197,8 @@ def cutout_mask(
198197    if  min_distance_km  is  not   None :
199198        min_distance  =  min_distance_km  /  6371.0 
200199    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 ])
204202
205203    LOG .debug (f"cutout_mask using min_distance = { min_distance  *  6371.0 }   km" )
206204
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments