Closed TomNicholas closed 1 month ago
Indeed, something is definitely going wrong in the from_dict
constructor.
Looks at what dt['weather']
looks like -- it's even worse, with a duplicate "time"
coordinate!
In [7]: dt2['weather']
Out[7]:
<xarray.DataTree 'weather'>
Group: /weather
│ Dimensions: (time: 2, station: 6)
│ Coordinates:
│ * time (time) <U7 56B '2022-01' '2023-01'
│ * station (station) <U1 24B 'a' 'b' 'c' 'd' 'e' 'f'
│ Inherited coordinates:
│ * time (time) <U7 56B '2022-01' '2023-01'
│ Data variables:
│ wind_speed (time, station) float64 96B 2.0 2.0 2.0 2.0 ... 2.0 2.0 2.0 2.0
│ pressure (time, station) float64 96B 3.0 3.0 3.0 3.0 ... 3.0 3.0 3.0 3.0
└── Group: /weather/temperature
Dimensions: (time: 2, station: 6)
Data variables:
air_temperature (time, station) float64 96B 4.0 4.0 4.0 4.0 ... 4.0 4.0 4.0
dewpoint (time, station) float64 96B 5.0 5.0 5.0 5.0 ... 5.0 5.0 5.0
What is your issue?
The example DataTree under "DataTree Inheritance" on the Data Structures docs page doesn't display the way I expected it to.
It currently looks like this:
Which notice has an identical
time
coordinate displayed in multiple child groups.But I expected it to look like this:
which only has
time
defined in the root group. Based on #9463 I expected the inheritance onto child node to be implicit, and not have the same coordinate explicitly displayed twice.I also don't understand why the current repr does not have
time
displayed in the/weather/temperature
node.It's possible that this is caused by an interaction between #9475 and
.from_dict
(I haven't looked into this deeply yet), but I wanted to make a note that we should come back to check this definitely works once #9475 is resolved.cc @shoyer @flamingbear