Skip to content

Commit 8ea3c4a

Browse files
Adding docstring for _search_indices_curvilinear_2d()
1 parent 3bb5bcf commit 8ea3c4a

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

parcels/_index_search.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,30 @@ def curvilinear_point_in_cell(grid, y: np.ndarray, x: np.ndarray, yi: np.ndarray
7777
def _search_indices_curvilinear_2d(
7878
grid: XGrid, y: np.ndarray, x: np.ndarray, yi: np.ndarray | None = None, xi: np.ndarray | None = None
7979
):
80+
"""Searches a grid for particle locations in 2D curvilinear coordinates.
81+
82+
Parameters
83+
----------
84+
grid : XGrid
85+
The curvilinear grid to search within.
86+
y : np.ndarray
87+
Array of latitude-coordinates of the points to locate.
88+
x : np.ndarray
89+
Array of longitude-coordinates of the points to locate.
90+
yi : np.ndarray | None, optional
91+
Array of initial guesses for the j indices of the points to locate.
92+
xi : np.ndarray | None, optional
93+
Array of initial guesses for the i indices of the points to locate.
94+
95+
Returns
96+
-------
97+
tuple
98+
A tuple containing four elements:
99+
- yi (np.ndarray): Array of found j-indices corresponding to the input coordinates.
100+
- eta (np.ndarray): Array of barycentric coordinates in the j-direction within the found grid cells.
101+
- xi (np.ndarray): Array of found i-indices corresponding to the input cooordinates.
102+
- xsi (np.ndarray): Array of barycentric coordinates in the i-direction within the found grid cells.
103+
"""
80104
if np.any(xi):
81105
# If an initial guess is provided, we first perform a point in cell check for all guessed indices
82106
is_in_cell, coords = curvilinear_point_in_cell(grid, y, x, yi, xi)

0 commit comments

Comments
 (0)