🍾 Xarray is now 10 years old! 🎉

xarray.Index.roll

Contents

xarray.Index.roll#

Index.roll(shifts)[source]#

Roll this index by an offset along one or more dimensions.

This method can be re-implemented in subclasses of Index, e.g., when the index can be itself indexed.

If not re-implemented, this method returns None, i.e., calling Dataset.roll() will either drop the index in the resulting dataset or pass it unchanged if its corresponding coordinate(s) are not rolled.

Parameters:

shifts (mapping of hashable to int, optional) – A dict with keys matching dimensions and values given by integers to rotate each of the given dimensions, as passed Dataset.roll().

Returns:

rolled (Index) – A new index with rolled data.