issues: 595900209
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
595900209 | MDU6SXNzdWU1OTU5MDAyMDk= | 3949 | Index 3D array with index of last axis stored in 2D array | 30388627 | closed | 0 | 2 | 2020-04-07T14:13:39Z | 2020-04-07T14:30:12Z | 2020-04-07T14:30:12Z | NONE | This is copied from a question on stackoverflow.
MCVE Code Sample```python import numpy as np val_arr = np.arange(27).reshape(3, 3, 3) z_indices = np.array([[1, 0, 2], [0, 0, 1], [2, 0, 1]]) index_array = z_indices.choose(val_arr) print(index_array) ``` xarray version```python import numpy as np import xarray as xr val_arr = xr.DataArray(np.arange(27).reshape(3, 3, 3), dims=['z', 'y', 'x']) z_indices = xr.DataArray(np.array([[1, 0, 2], [0, 0, 1], [2, 0, 1]]), dims=['y', 'x']) index_array = np.choose(z_indices, val_arr) print(index_array) ``` Expected Output
Problem DescriptionIs this feature of |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3949/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |