xarray.Coordinates#
- class xarray.Coordinates(coords=None, indexes=None)[source]#
Dictionary like container for Xarray coordinates (variables + indexes).
This collection is a mapping of coordinate names to
DataArrayobjects.It can be passed directly to the
DatasetandDataArrayconstructors via their coords argument. This will add both the coordinates variables and their index.Coordinates are either:
returned via the
Dataset.coordsandDataArray.coordsproperties.built from index objects (e.g.,
Coordinates.from_pandas_multiindex()).built directly from coordinate data and index objects (beware that no consistency check is done on those inputs).
In the latter case, no default (pandas) index is created.
- Parameters:
coords (dict-like) – Mapping where keys are coordinate names and values are objects that can be converted into a
Variableobject (seeas_variable()).indexes (dict-like) – Mapping of where keys are coordinate names and values are
Indexobjects.
Methods
__init__([coords, indexes])copy([deep, memo])Return a copy of this Coordinates object.
equals(other)Two Coordinates objects are equal if they have matching variables, all of which are equal.
from_pandas_multiindex(midx, dim)Wrap a pandas multi-index as Xarray coordinates (dimension + levels).
get(k[,d])identical(other)Like equals, but also checks all variable attributes.
items()keys()merge(other)Merge two sets of coordinates to create a new Dataset
Convert these coordinates into a new Dataset.
to_index([ordered_dims])Convert all index coordinates into a
pandas.Index.update(other)Update this Coordinates variables with other coordinate variables.
values()Attributes
Mapping from dimension names to lengths or tuple of dimension names.
Mapping from coordinate names to dtypes.
Mapping of pandas.Index objects used for label based indexing.
sizesMapping from dimension names to lengths.
Low level interface to Coordinates contents as dict of Variable objects.
Mapping of
Indexobjects used for label based indexing.