-
On xarray 0.20.1 If I make a simple Dataset and try to assign to a variable I now get an error: dat = xr.Dataset(coords=dict(x=np.linspace(0,10., 100)),
data_vars=dict(thedata=('x', np.zeros(100))))
dat['thedata'] = np.arange(100)
Of course I can do: dat['thedata'] = ('x', np.arange(100)) or dat['thedata'].values = np.arange(100) or dat['thedata'][:] = np.arange(100) all work fine. However, I do not remember this as being necessary, nor do I think they should be if the RHS has the right dimensions and is a bare numpy array... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
OK, I take it back, I guess the simple assignment never worked, or at least not as far back as I'd care to check (0.10.3). I guess I understand why this happens - xarray doesn't know if I want |
Beta Was this translation helpful? Give feedback.
OK, I take it back, I guess the simple assignment never worked, or at least not as far back as I'd care to check (0.10.3).
I guess I understand why this happens - xarray doesn't know if I want
dat['thedata']
to be a new variable or to fill the old one. However, I'm not sure what harm would be done by letting the assignment work without indexing if the alternative is a failed merge.