Attrs for default coordinate arrays - confusing - intended? #8567
-
Sorry for the introductory question, but we (@ivanov and I) ran into this behavior while experimenting: import numpy as np
data = np.zeros((3, 4, 5))
ds = xr.DataArray(data, dims=('i', 'j', 'k'))
print(ds['k'].attrs) This shows ds['k'].attrs['foo'] = 'bar'
print(ds['k'].attrs) This also gives Thanks for any help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, there is no underlying data stored.
I think we should raise an error on that attribute assignment. The message would recommend assigning values to that coordinate first |
Beta Was this translation helpful? Give feedback.
Yes, there is no underlying data stored.
I think we should raise an error on that attribute assignment. The message would recommend assigning values to that coordinate first
ds['k'] = np.arange(ds.sizes['k'])