issue_comments: 321115367
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/1473#issuecomment-321115367 | https://api.github.com/repos/pydata/xarray/issues/1473 | 321115367 | MDEyOklzc3VlQ29tbWVudDMyMTExNTM2Nw== | 6815844 | 2017-08-09T00:06:10Z | 2017-08-09T00:06:10Z | MEMBER | I am wondering how the indexing by In my current implementation, it bahaves ```python In [1]: import numpy as np ...: import xarray as xr ...: ...: da = xr.DataArray(np.arange(3 * 2).reshape(3, 2), dims=['x', 'y'], ...: coords={'x': [0, 1, 2], 'y': ['a', 'b']}) ...: da ...: Out[1]: <xarray.DataArray (x: 3, y: 2)> array([[0, 1], [2, 3], [4, 5]]) Coordinates: * x (x) int64 0 1 2 * y (y) <U1 'a' 'b' In [2]: ind = xr.DataArray([2, 1], dims=['a'], ...: coords={'a': [0.1, 0.2], 'time': (('a', ), [10, 20])}) ...: ind # 'a': coordinate, 'time': non-dimension coordinate ...: Out[2]: <xarray.DataArray (a: 2)> array([2, 1]) Coordinates: * a (a) float64 0.1 0.2 time (a) int64 10 20 In [3]: da.isel(x=ind) Out[3]: <xarray.DataArray (a: 2, y: 2)> array([[4, 5], [2, 3]]) Coordinates: x (a) int64 2 1 * y (y) <U1 'a' 'b' * a (a) float64 0.1 0.2 ``` I think we should keep (indexed-version of the) original coordinate ( I am slightly worrying that after repetitive indexing the number of coordinates may unintentionally increase. |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
241578773 |