@@ -101,8 +101,8 @@ def _hash_index(self, coords):
101101
102102 def _grid_ij_for_eid (self , eid ):
103103 """Returns the (i,j) grid coordinates for the given element id (eid)"""
104- j = eid // (self ._source_grid .xdim - 1 )
105- i = eid - j * (self ._source_grid .xdim - 1 )
104+ j = eid // (self ._source_grid .xdim )
105+ i = eid - j * (self ._source_grid .xdim )
106106 return i , j
107107
108108 def _initialize_face_hash_table (self ):
@@ -132,7 +132,8 @@ def _initialize_face_hash_table(self):
132132 axis = - 1 ,
133133 )
134134 xi2 , yi2 = self ._hash_index2d (coords )
135- for eid in range (lon_bounds .shape [0 ]):
135+ nface = (self ._source_grid .xdim ) * (self ._source_grid .ydim )
136+ for eid in range (nface ):
136137 for j in range (yi1 [eid ], yi2 [eid ] + 1 ):
137138 if xi1 [eid ] <= xi2 [eid ]:
138139 # Normal case, no wrap
@@ -194,20 +195,16 @@ def query(
194195 axis = - 1 ,
195196 )
196197
197- print (f"Coords: { coords } , Candidate faces: { candidate_faces } " )
198198 for i , (coord , candidates ) in enumerate (zip (coords , candidate_faces , strict = False )):
199199 for face_id in candidates :
200200 xi , yi = self ._grid_ij_for_eid (face_id )
201- print (f"Checking face { face_id } at grid position ({ xi } , { yi } ) for coord { coord } " )
202201 nodes = np .stack (
203202 (
204203 xbound [yi , xi , :],
205204 ybound [yi , xi , :],
206205 ),
207206 axis = - 1 ,
208207 )
209- for k in range (4 ):
210- print (f"Node { k } : { nodes [k ]} " )
211208
212209 bcoord = np .asarray (_barycentric_coordinates (nodes , coord ))
213210 err = abs (np .dot (bcoord , nodes [:, 0 ]) - coord [0 ]) + abs (np .dot (bcoord , nodes [:, 1 ]) - coord [1 ])
0 commit comments