issues: 231835326
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
231835326 | MDU6SXNzdWUyMzE4MzUzMjY= | 1430 | setting values with getattr performs wrong opperation with multi-dimensional coordinate | 11671536 | closed | 0 | 3 | 2017-05-27T23:44:14Z | 2019-04-30T03:17:20Z | 2019-04-30T03:17:20Z | NONE | I am using Ubuntu 16, python 3.6, and xarray 0.9.1 Consider the following code: ```python import xarray as xr import numpy as np dims = ['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 elements expected_values = np.array([[1, 1], [1, 0]]) yet this raises because all four values are set to 1assert np.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:
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/1430/reactions", "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |