Find a set of element indicies for a number of points or within an area.
The returned indices returned are the unique, unordered set of element indices that contain the points or area.
This method will return elements containing the argument points/area, which is not necessarily the same as the nearest.
Typically not called directly, but by Dataset/DataArray’s sel() method.
Parameters
Name
Type
Description
Default
x
float | np.ndarray | None
X coordinate(s) (easting or longitude)
None
y
float | np.ndarray | None
Y coordinate(s) (northing or latitude)
None
coords
np.array(float, float)
As an alternative to specifying x, and y individually, the argument coords can be used instead. (x,y)-coordinates of points to be found, by default None
None
area
(float, float, float, float)
Bounding box of coordinates (left lower and right upper) to be selected, by default None
None
Returns
Name
Type
Description
np.array
indicies of containing elements
Raises
Name
Type
Description
ValueError
if any point is outside the domain
Examples
>>> g = dfs.geometry>>>id= dfs.find_index(x=3.1, y=4.3)
See Also
isel : get subset geometry for specific indicies find_nearest_elements : find nearest instead of containing elements
find_nearest_elements
spatial.GeometryFMAreaSpectrum.find_nearest_elements( x y=None n_nearest=1 return_distances=False)
Find index of nearest elements (optionally for a list)
Parameters
Name
Type
Description
Default
x
float | np.ndarray
X coordinate(s) (easting or longitude)
required
y
float | np.ndarray | None
Y coordinate(s) (northing or latitude)
None
n_nearest
int
return this many (horizontally) nearest points for each coordinate set, default=1
1
return_distances
bool
should the horizontal distances to each point be returned? default=False