xarray.DataArray.xoak.set_index

DataArray.xoak.set_index(coords, index_type, persist=True, **kwargs)

Create an index tree from a subset of coordinates of the DataArray / Dataset.

If the given coordinates are chunked (Dask arrays), this method will (lazily) create a forest of index trees (one tree per chunk of the flattened coordinate arrays).

Parameters
  • coords (iterable) – Coordinate names. Each given coordinate must have the same dimension(s), in the same order.

  • index_type (str or IndexAdapter subclass) – Either a registered index adapter (see IndexRegistry) or a custom IndexAdapter subclass.

  • persist (bool) – If True (default), this method will precompute and persist in memory the forest of index trees, if any.

  • **kwargs – Keyword arguments that will be passed to the underlying index constructor.