Skip to content

Consider indicating inherited coordinates & dimensions in DataTree repr #9463

Closed
@shoyer

Description

@shoyer

What is your issue?

Showing these in the repr makes it harder to understand the DataTree at a glance. In particular, it makes it impossible to immediately see if coordinates are duplicated or not, e.g., consider these two cases, which have the same repr but would serialize to Zarr differently:

In [6]: DataTree.from_dict({'/': Dataset(coords={'x': [1]}), '/sub': Dataset({'foo': 1})})
Out[6]:
<xarray.DataTree>
Group: /
│   Dimensions:  (x: 1)
│   Coordinates:
│     * x        (x) int64 8B 1
│   Data variables:
│       *empty*
└── Group: /sub
        Dimensions:  (x: 1)
        Coordinates:
          * x        (x) int64 8B 1
        Data variables:
            foo      int64 8B 1

In [8]: DataTree.from_dict({'/': Dataset(coords={'x': [1]}), '/sub': Dataset({'foo': 1}, coords={'x': [1]})})
Out[8]:
<xarray.DataTree>
Group: /
│   Dimensions:  (x: 1)
│   Coordinates:
│     * x        (x) int64 8B 1
│   Data variables:
│       *empty*
└── Group: /sub
        Dimensions:  (x: 1)
        Coordinates:
          * x        (x) int64 8B 1
        Data variables:
            foo      int64 8B 1

The simplest way to indicate inherited coordinates/dimensions would be to not display them at all. But maybe there is a different way we could indicate such dimensions/variables (less prominently).

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-DataTreeRelated to the implementation of a DataTree class

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions