From 5d639c9a4fa4a3e8fd78bc1ca61beb687ed1263a Mon Sep 17 00:00:00 2001 From: Justus Magin Date: Wed, 14 May 2025 15:01:24 +0200 Subject: [PATCH 1/2] reword the introduction section of the ``Coordinates`` object --- doc/user-guide/data-structures.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/user-guide/data-structures.rst b/doc/user-guide/data-structures.rst index 5ce60e5c405..9633c1552d9 100644 --- a/doc/user-guide/data-structures.rst +++ b/doc/user-guide/data-structures.rst @@ -808,6 +808,19 @@ For more examples and further discussion see :ref:`alignment and coordinate inhe Coordinates ----------- +The :py:class:`xarray.Coordinates` object is a dict-like container that contains coordinate variables and the associated indexes. It is mainly used as the return value of the ``coords`` property of the ``DataArray``, ``Dataset``, and ``DataTree``: + +.. ipython:: python + + foo.coords + ds.coords + dt.coords + +But can also be used to customize the behavior of the constructors of these classes or to transfer or combine coordinates from different objects. + +Coordinate variables +~~~~~~~~~~~~~~~~~~~~ + Coordinates are ancillary variables stored for ``DataArray`` and ``Dataset`` objects in the ``coords`` attribute: From 056843ddac78ab228d51143eb2e264e06da73ce9 Mon Sep 17 00:00:00 2001 From: Justus Magin Date: Wed, 14 May 2025 15:02:15 +0200 Subject: [PATCH 2/2] remove duplicated information --- doc/user-guide/data-structures.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/doc/user-guide/data-structures.rst b/doc/user-guide/data-structures.rst index 9633c1552d9..22436961647 100644 --- a/doc/user-guide/data-structures.rst +++ b/doc/user-guide/data-structures.rst @@ -821,16 +821,7 @@ But can also be used to customize the behavior of the constructors of these clas Coordinate variables ~~~~~~~~~~~~~~~~~~~~ -Coordinates are ancillary variables stored for ``DataArray`` and ``Dataset`` -objects in the ``coords`` attribute: - -.. ipython:: python - - ds.coords - -Unlike attributes, xarray *does* interpret and persist coordinates in -operations that transform xarray objects. There are two types of coordinates -in xarray: +Coordinate variables (or simply coordinates) are ancillary variables stored in ``DataArray``, ``Dataset``, and ``DataTree`` objects. Unlike attributes, xarray *does* interpret coordinates in operations that transform xarray objects. There are two types of coordinates in xarray: - **dimension coordinates** are one dimensional coordinates with a name equal to their sole dimension (marked by ``*`` when printing a dataset or data