xugrid.UgridDataArrayAccessor.sel#

UgridDataArrayAccessor.sel(x=None, y=None)[source]#

Return a new object, a subselection in the UGRID x and y coordinates.

The indexing for x and y always occurs orthogonally, i.e.: .sel(x=[0.0, 5.0], y=[10.0, 15.0]) results in a four points. For vectorized indexing (equal to zip``ing through x and y), see ``.sel_points.

Depending on the nature of the x and y indexers, a xugrid or xarray object is returned:

  • slice without step: x=slice(-100, 100): returns xugrid object, a part of the unstructured grid.

  • slice with step: x=slice(-100, 100, 10): returns xarray object, a series of points (x=[-100, -90, -80, …, 90, 100]).

  • a scalar: x=5.0: returns xarray object, a point.

  • an array: x=[1.0, 15.0, 17.0]: returns xarray object, a series of points.

Parameters:
  • x (float, 1d array, slice)

  • y (float, 1d array, slice)

Returns:

selection

Return type:

Union[UgridDataArray, UgridDataset, xr.DataArray, xr.Dataset]