Closed shoyer closed 3 weeks ago
I'm trying to have a go at this but it's made harder by #9203 not being implemented. The problem is that the DatasetCoordinates
class works by storing the Dataset
object as ._data
, then altering it in-place by altering ._data._variables
and ._data._coord_names
. But the same approach doesn't work for DataTree
because that uses ._data_variables
and ._coord_variables
internally, so you can't get away with just passing the DataTree
object to the DatasetCoordinates
constructor, even though conceptually that should work.
So to make it work right now requires a new DataTreeCoordinates
object. That's fine, but if #9203 were completed then we wouldn't really need that new class.
Ah yes - I forgot there's a TODO deep somewhere for that 😅 I left it for later because it seemed like it might require changing the
DatasetCoordinates
class thatds.coords
returns. (Surely that class could just be replaced by the newxr.Coordinates
class now??)Originally posted by @TomNicholas in https://github.com/pydata/xarray/issues/9063#issuecomment-2189180572