Open
Description
Consider
from collections import *
import numpy as np
from xray import *
d1 = DataArray(np.empty((2, 2)), coords=OrderedDict([("foo", [0, 1]), ("bar", [0, 1])]))
d2 = DataArray(np.empty((2, 2)), coords=OrderedDict([("bar", [0, 1]), ("foo", [0, 1])]))
ds = Dataset({"d1": d1, "d2": d2})
print(ds.d1)
print(ds.d2)
This outputs
<xray.DataArray 'd1' (foo: 2, bar: 2)>
array([[ 6.91516848e-310, 1.64244654e-316],
[ 6.91516881e-310, 6.91516881e-310]])
Coordinates:
* foo (foo) int64 0 1
* bar (bar) int64 0 1
<xray.DataArray 'd2' (bar: 2, foo: 2)>
array([[ 1.59987863e-316, 6.91516883e-310],
[ 6.91515690e-310, 2.12670320e-316]])
Coordinates:
* foo (foo) int64 0 1
* bar (bar) int64 0 1
I understand that internally both DataArrays use the same coords object and thus the same coords order, but it would be helpful if, when printing d2 by itself, the coordinates were printed in the natural order ("bar", "foo"). In particular, when working interactively, the list of coordinates at the end of the repr is the most easy thing to spot, and thus most helpful to know how to format the call to array.loc[...]
.
Metadata
Metadata
Assignees
Labels
No labels