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/issues/811#issuecomment-204499580,https://api.github.com/repos/pydata/xarray/issues/811,204499580,MDEyOklzc3VlQ29tbWVudDIwNDQ5OTU4MA==,1217238,2016-04-01T18:13:52Z,2016-04-01T18:13:52Z,MEMBER,"Also, just for future reference usually we close feature requests when the
corresponding PR has been merged :)
On Fri, Apr 1, 2016 at 11:04 AM, Phillip Wolfram notifications@github.com
wrote:
> Closed #811 https://github.com/pydata/xarray/issues/811.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly or view it on GitHub
> https://github.com/pydata/xarray/issues/811#event-611609243
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,144683276
https://github.com/pydata/xarray/issues/811#issuecomment-203691509,https://api.github.com/repos/pydata/xarray/issues/811,203691509,MDEyOklzc3VlQ29tbWVudDIwMzY5MTUwOQ==,1217238,2016-03-31T00:08:39Z,2016-03-31T00:08:39Z,MEMBER,"If I'm understanding you correctly, the use case is to trim off all NA regions when using `where` for selection. If your mask is not perfectly rectangular, some values will still be replaced with NA.
A starting point would be something like this:
``` python
def sel_where(data, mask):
data, mask = xr.broadcast(xr.align(data, mask, join='left', copy=False))
# possibly not a good idea to expand mask to the full dimensions of the data
indexes = tuple(mask.any(dim).values for dim in mask.dims)
return data[indexes].where(mask[indexes])
```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,144683276
https://github.com/pydata/xarray/issues/811#issuecomment-203678531,https://api.github.com/repos/pydata/xarray/issues/811,203678531,MDEyOklzc3VlQ29tbWVudDIwMzY3ODUzMQ==,1217238,2016-03-30T23:18:32Z,2016-03-30T23:18:32Z,MEMBER,"I'm still not sure exactly what you mean by this ""contraction"" like behavior. Could you write this out in pseudo code?
This is pretty different from `.sel` and not in the way that `reindex_like` is different from `reindex`, so possibly another name would be appropriate.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,144683276
https://github.com/pydata/xarray/issues/811#issuecomment-203662498,https://api.github.com/repos/pydata/xarray/issues/811,203662498,MDEyOklzc3VlQ29tbWVudDIwMzY2MjQ5OA==,1217238,2016-03-30T22:11:35Z,2016-03-30T22:11:35Z,MEMBER,"I would rather make a `sel_like` method for remapping `acase.sel_like(idx)` -> `acase.sel(x=idx.x.values, y=idx.y.values)`. That would mirror the current `reindex`/`reindex_like` distinction, though `reindex_like` does solve many of these use cases.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,144683276
https://github.com/pydata/xarray/issues/811#issuecomment-203633885,https://api.github.com/repos/pydata/xarray/issues/811,203633885,MDEyOklzc3VlQ29tbWVudDIwMzYzMzg4NQ==,1217238,2016-03-30T20:57:24Z,2016-03-30T20:57:24Z,MEMBER,"If `acase` and `idx` (a boolean) both have dimensions `('x', 'y')`, what should `acase.sel(idx)` or `acase[idx]` do?
NumPy will return a 1D flattened array in this case. We could do that (with a MultiIndex) but that's not so useful in xarray.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,144683276
https://github.com/pydata/xarray/issues/811#issuecomment-203628130,https://api.github.com/repos/pydata/xarray/issues/811,203628130,MDEyOklzc3VlQ29tbWVudDIwMzYyODEzMA==,1217238,2016-03-30T20:44:34Z,2016-03-30T20:44:34Z,MEMBER,"You can write `acase.where(idx)`, but we don't support `acase.sel(idx)` because it's not clear what do to if `idx` has more than one dimension.
I suppose we could allow `acase.sel(idx1, idx2, ...)` if all the provided arguments are 1D.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,144683276
https://github.com/pydata/xarray/issues/811#issuecomment-203615938,https://api.github.com/repos/pydata/xarray/issues/811,203615938,MDEyOklzc3VlQ29tbWVudDIwMzYxNTkzOA==,10050469,2016-03-30T20:23:03Z,2016-03-30T20:23:03Z,MEMBER,"> Should xarray indexing account for boolean values without resorting to a call to np.where?
as far as I know, it does:
``` python
In [1]: import xarray as xr
In [2]: import numpy as np
In [3]: da = xr.DataArray(np.arange(10), coords={'time':np.arange(10)})
In [4]: da.sel(time=da.time > 4)
Out[4]:
array([5, 6, 7, 8, 9])
Coordinates:
* time (time) int64 5 6 7 8 9
```
But according to the traceback it seems to have something to do with the shape or your array?
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,144683276