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
Typically not called directly, but by Dataset/DataArray’s isel() or sel() methods.
Parameters
Name
Type
Description
Default
idx
list(int)
collection of element indicies
required
keepdims
bool
Should the original Geometry type be kept (keepdims=True) or should it be reduced e.g. to a GeometryPoint2D if possible (keepdims=False), by default False
False
**kwargs
Any
Not used
{}
Returns
Name
Type
Description
Geometry
geometry subset
See Also
find_index : find element indicies for points or an area