home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 327670299

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-327670299 https://api.github.com/repos/pydata/xarray/issues/1473 327670299 MDEyOklzc3VlQ29tbWVudDMyNzY3MDI5OQ== 1217238 2017-09-07T03:02:18Z 2017-09-07T03:02:18Z MEMBER

Thinking about boolean indexing again. I think we possibly only allow using unlabeled boolean array or boolean arrays defined along the dimension they are indexing.

My concern is that otherwise, we will rule out the possibility of making data_array[boolean_key] equivalent to data_array.where(boolean_key, drop=True). For example, consider the current behavior with your branch: ``` In [29]: da = xr.DataArray(np.arange(100).reshape(10, 10), dims=['x', 'y'])

In [30]: da[da.x > -1] Out[30]: <xarray.DataArray (x: 10, y: 10)> array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [20, 21, 22, 23, 24, 25, 26, 27, 28, 29], [30, 31, 32, 33, 34, 35, 36, 37, 38, 39], [40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [50, 51, 52, 53, 54, 55, 56, 57, 58, 59], [60, 61, 62, 63, 64, 65, 66, 67, 68, 69], [70, 71, 72, 73, 74, 75, 76, 77, 78, 79], [80, 81, 82, 83, 84, 85, 86, 87, 88, 89], [90, 91, 92, 93, 94, 95, 96, 97, 98, 99]]) Dimensions without coordinates: x, y

In [31]: da[da.y > -1] Out[31]: <xarray.DataArray (y: 10)> array([ 0, 11, 22, 33, 44, 55, 66, 77, 88, 99]) Dimensions without coordinates: y ```

The only way these can be guaranteed to be consistent with where(drop=True) is if we only allow the first indexing argument to index along the first dimension (outer/orthogonal indexing style).

I can see some potential use for boolean indexing with a different dimension name, but I suspect it would be pretty rare. There is also an easy work around (using an integer indexer instead, which is also arguably clearer).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  241578773
Powered by Datasette · Queries took 0.885ms · About: xarray-datasette