Skip to content

Dataset.dims should return a set, not a dict of sizes #8496

Open
@TomNicholas

Description

@TomNicholas

What is your issue?

This is inconsistent:

In [25]: ds
Out[25]: 
<xarray.Dataset>
Dimensions:  (x: 1, y: 2)
Dimensions without coordinates: x, y
Data variables:
    a        (x, y) int64 0 1

In [26]: ds['a'].dims
Out[26]: ('x', 'y')

In [27]: ds['a'].sizes
Out[27]: Frozen({'x': 1, 'y': 2})

In [28]: ds.dims
Out[28]: Frozen({'x': 1, 'y': 2})

In [29]: ds.sizes
Out[29]: Frozen({'x': 1, 'y': 2})

Surely ds.dims should return something like a Frozenset({'x', 'y'})? (because dimension order is meaningless when you have multiple arrays underneath - see #8498)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions