Skip to content

Commit 59eecf7

Browse files
Add point_in_cell method to query call
1 parent 0cbbbc9 commit 59eecf7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/v4/test_spatialhash.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22

33
from parcels._datasets.structured.generic import datasets
4+
from parcels._index_search import curvilinear_point_in_cell
45
from parcels.xgrid import XGrid
56

67

@@ -15,7 +16,7 @@ def test_invalid_positions():
1516
ds = datasets["2d_left_rotated"]
1617
grid = XGrid.from_dataset(ds)
1718

18-
j, i = grid.get_spatial_hash().query([np.nan, np.inf], [np.nan, np.inf])
19+
j, i = grid.get_spatial_hash().query([np.nan, np.inf], [np.nan, np.inf], curvilinear_point_in_cell)
1920
assert np.all(j == -1)
2021
assert np.all(i == -1)
2122

@@ -27,7 +28,7 @@ def test_mixed_positions():
2728
lon = grid.lon.mean()
2829
y = [lat, np.nan]
2930
x = [lon, np.nan]
30-
j, i = grid.get_spatial_hash().query(y, x)
31+
j, i = grid.get_spatial_hash().query(y, x, curvilinear_point_in_cell)
3132
assert j[0] == 29 # Actual value for 2d_left_rotated center
3233
assert i[0] == 14 # Actual value for 2d_left_rotated center
3334
assert j[1] == -1

0 commit comments

Comments
 (0)