xugrid.Ugrid2d.sel_points#

Ugrid2d.sel_points(obj, x: ndarray, y: ndarray, out_of_bounds='warn', fill_value=nan)[source]#

Select points in the unstructured grid.

Parameters:
  • x (1d array of floats with shape (n_points,))

  • y (1d array of floats with shape (n_points,))

  • obj (xr.DataArray or xr.Dataset)

  • out_of_bounds (str, default "warn") –

    What to do when points are located outside of any feature:

    • raise: raise a ValueError.

    • ignore: return fill_value for the out of bounds points.

    • warn: give a warning and return NaN for the out of bounds points.

    • drop: drop the out of bounds points. They may be identified via the index coordinate of the returned selection.

  • fill_value (scalar, DataArray, Dataset, or callable, optional, default: np.nan) – Value to assign to out-of-bounds points if out_of_bounds is warn or ignore. Forwarded to xarray’s .where() method.

Returns:

selection – The name of the topology is prefixed in the x, y coordinates.

Return type:

xr.DataArray or xr.Dataset