xarray.Dataset.xoak.set_index

xarray.Dataset.xoak.set_index#

Dataset.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).

Warning

This method has been deprecated. Please use the Xarray API instead, e.g., ds.set_xindex([...], xarray.indexes.NDPointIndex, tree_adapter_cls=...).

Support for chunked Dask coordinates has been deprecated as well.

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.