Open TomNicholas opened 2 months ago
Dimensions part of coordinates, even if they aren't present on coordinate variables -- we need them for correct alignment.
So I think we should add them to the repr instead, ideally something like:
>>> ds.coords
<xarray.Coordinates>
Dimensions: (x: 2)
Coordinates:
*empty*
we need them for correct alignment
Can you do xr.align
on a ds.coords
object?
Also note how similar this question is to #9463...
Can you do
xr.align
on ads.coords
object?
Yes, it looks like this works, though I'm a little puzzled by how :)
Regardless, you definitely need dims
+ coords
(+ indexes
) to do alignment. So it makes sense to display them in the Coordinates repr.
This (on
main
) looks wrong to me:I mean the fact no-one has raised this before means it probably isn't of much consequence, but it does seem incorrect / misleading.
_Originally posted by @TomNicholas in https://github.com/pydata/xarray/pull/9451#discussion_r1749072922_
The issue here being that the
DatasetCoordinates
object displays a dim with no associated variable.I'm not sure whether anything about the concept of "virtual coordinate variables" affects this.
(The
FrozenMappingWarningOnValuesAccess
is just aMapping
, it's only weird due to the ongoing deprecation cycle started in #8500.)