home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 277441150

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
277441150 MDU6SXNzdWUyNzc0NDExNTA= 1743 Assigning data to vector-indexed data doesn't seem to work 167802 closed 0     4 2017-11-28T16:06:56Z 2022-02-23T12:23:42Z 2017-12-09T03:29:35Z CONTRIBUTOR      

Code Sample

```python import xarray as xr import numpy as np import dask.array as da

arr = np.arange(25).reshape((5, 5))

l_indices = xr.DataArray(np.array(((0, 1), (2, 3))), dims=['lines', 'cols']) c_indices = xr.DataArray(np.array(((1, 3), (0, 2))), dims=['lines', 'cols'])

xarr = xr.DataArray(da.from_array(arr, chunks=10), dims=['y', 'x'])

print(xarr[l_indices, c_indices])

xarr[l_indices, c_indices] = 2 ```

Problem description

This crashes on the last line with a IndexError: Unlabeled multi-dimensional array cannot be used for indexing: [[0 1] [2 3]] I'm expecting to be able to do assignment this way, and it doesn't work.

Expected Output

Expected output is the modified array with 2's in the indicated positions

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 2.7.5.final.0 python-bits: 64 OS: Linux OS-release: 3.10.0-693.2.2.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: None.None xarray: 0.10.0 pandas: 0.21.0 numpy: 1.13.3 scipy: 0.18.1 netCDF4: 1.1.8 h5netcdf: 0.4.2 Nio: None bottleneck: None cyordereddict: None dask: 0.15.4 matplotlib: 1.2.0 cartopy: None seaborn: None setuptools: 36.2.1 pip: 9.0.1 conda: None pytest: 3.1.3 IPython: 5.1.0 sphinx: 1.3.6
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1743/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 4 rows from issue in issue_comments
Powered by Datasette · Queries took 0.622ms · About: xarray-datasette