issue_comments: 608322689
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | performed_via_github_app | issue |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/pydata/xarray/pull/3922#issuecomment-608322689 | https://api.github.com/repos/pydata/xarray/issues/3922 | 608322689 | MDEyOklzc3VlQ29tbWVudDYwODMyMjY4OQ== | 14808389 | 2020-04-03T09:06:42Z | 2020-04-03T09:06:42Z | MEMBER | The issue is that To get your 3D example (and potentially every N-D example) to work, simply fall back to the wrapped array's integer indexing (using In [3]: indx = array.argmin(dim='z', keep_attrs=True, skipna=False) ...: res = indx.copy( ...: data=indx.data.map_blocks( ...: lambda ind, coord: coord[(ind,)], ...: array.z.data, ...: dtype=array.z.dtype ...: ) ...: ) In [4]: res.compute()
Out[4]:
<xarray.DataArray 'data_arr' (x: 10, y: 20)>
array([[20, 3, 3, 11, 20, 17, 3, 27, 24, 1, 7, 4, 22, 14, 7, 18,
5, 18, 7, 19],
[10, 21, 25, 3, 15, 25, 28, 8, 10, 9, 13, 3, 24, 17, 19, 23,
12, 19, 19, 28],
[ 1, 26, 10, 9, 16, 8, 17, 8, 6, 24, 28, 13, 23, 22, 26, 13,
28, 11, 6, 16],
[ 6, 9, 26, 27, 1, 2, 21, 8, 10, 19, 14, 14, 20, 25, 24, 4,
18, 12, 20, 2],
[22, 5, 12, 17, 13, 23, 23, 8, 27, 22, 1, 19, 26, 16, 12, 17,
19, 28, 8, 12],
[20, 8, 25, 13, 4, 12, 23, 13, 27, 18, 15, 28, 10, 10, 0, 12,
5, 14, 5, 27],
[29, 0, 19, 7, 15, 2, 8, 8, 13, 4, 12, 1, 7, 19, 14, 0,
3, 7, 12, 9],
[ 9, 8, 4, 9, 17, 6, 7, 5, 29, 0, 15, 28, 22, 6, 24, 24,
20, 0, 24, 23],
[ 1, 19, 12, 20, 4, 26, 5, 13, 21, 26, 25, 10, 5, 1, 11, 21,
6, 18, 4, 21],
[15, 27, 13, 7, 25, 3, 14, 14, 17, 15, 11, 4, 16, 22, 22, 23,
0, 16, 26, 13]])
Coordinates:
* x (x) int64 0 1 2 3 4 5 6 7 8 9
* y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
591101988 |