imod.select.points_in_bounds#

imod.select.points_in_bounds(da: DataArray | UgridDataArray, **points) ndarray[Any, dtype[bool]][source]#

Returns whether points specified by keyword arguments fall within the bounds of da.

Parameters:
  • da (xr.DataArray)

  • points (keyword arguments of coordinate=values) – keyword arguments specifying coordinate and values. Please refer to the examples.

Returns:

in_bounds

Return type:

np.array of bools

Examples

Create the DataArray, then use the keyword arguments to define along which coordinate to check whether the points are within bounds.

>>> nrow, ncol = 3, 4
>>> data = np.arange(12.0).reshape(nrow, ncol)
>>> coords = {"x": [0.5, 1.5, 2.5, 3.5], "y": [2.5, 1.5, 0.5]}
>>> dims = ("y", "x")
>>> da = xr.DataArray(data, coords, dims)
>>> x = [0.4, 2.6]
>>> points_in_bounds(da, x=x)

This works for an arbitrary number of coordinates:

>>> y = [1.3, 2.7]
>>> points_in_bounds(da, x=x, y=y)