You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Ubuntu 16, python 3.6, and xarray 0.9.1
Consider the following code:
importxarrayasxrimportnumpyasnpdims= ['a', 'b']
coords= {'a': range(2), 'b':range(2), 'group': (('a', 'b'), [[0, 0], [0, 1]])}
values= [[0, 0], [0, 0]]
dar=xr.DataArray(values, coords, dims)
dar[dict(group=0)] =1# group is only 0 for three of the four elementsexpected_values=np.array([[1, 1], [1, 0]])
# yet this raises because all four values are set to 1assertnp.all(np.isclose(dar.values, expected_values))
I suspect trying to assign values in this way using a multi-dimensional coordinate should raise a ValueError as this does:
dar[dict(group=0)]
The text was updated successfully, but these errors were encountered:
Thanks for the report. This should actually raise an error instead -- indexing with coordinates that don't go along a dimension is not supported. For example, note:
In [37]: dar[dict(group=0)]
ValueError: dimensions ['group'] do not exist
I am using Ubuntu 16, python 3.6, and xarray 0.9.1
Consider the following code:
I suspect trying to assign values in this way using a multi-dimensional coordinate should raise a ValueError as this does:
The text was updated successfully, but these errors were encountered: