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/987#issuecomment-242953090,https://api.github.com/repos/pydata/xarray/issues/987,242953090,MDEyOklzc3VlQ29tbWVudDI0Mjk1MzA5MA==,1063143,2016-08-28T02:58:24Z,2016-08-28T02:58:24Z,NONE,"@shoyer I think I saw `...` a long time ago and must have forgotten about it. Thank you so much for reminding me - I was really hoping for something like `...` for a while.
Btw, I must say not only that xarray is just so useful for many of my research, but also the devs' responses on the issues have been superb. Definitely one of the most pleasant experiences I have had with developers. Thank you.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,173494017
https://github.com/pydata/xarray/issues/987#issuecomment-242940333,https://api.github.com/repos/pydata/xarray/issues/987,242940333,MDEyOklzc3VlQ29tbWVudDI0Mjk0MDMzMw==,1063143,2016-08-27T20:55:59Z,2016-08-27T20:59:09Z,NONE,"Sure. My actual usage is usually much more complicated, but basically, with
``` python
import numpy as np
import xarray as xr
X = xr.DataArray(np.random.normal(size=(10, 10)),
coords=[range(10), range(10)],)
```
if I want to choose only values larger than 0 from X, it seems I cannot do `X[X > 0]`, I have to do `X.values[X.values > 0]`. You can see how this thing can quickly get long if I'm doing this for assignment with multidimensional xarrays - something like
``` python
X.loc[:, :, :, 'variable'].values[X.loc[:, :, :, 'variable'].values > 0] = Y.loc[:, :, :, 'variable'].values[Y.loc[:, :, :, 'variable'].values > 0]
```
Maybe I'm mistaken and there is a way to do this more nicely, but I haven't been able to figure it out.
Thank you!
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,173494017
https://github.com/pydata/xarray/issues/987#issuecomment-242937958,https://api.github.com/repos/pydata/xarray/issues/987,242937958,MDEyOklzc3VlQ29tbWVudDI0MjkzNzk1OA==,1063143,2016-08-27T20:06:12Z,2016-08-27T20:06:12Z,NONE,"Thanks a lot for the discussions. I agree it is very important to be consistent and explicit. Another thing was that sometimes `.values` makes a line of code really long - especially when I want to index a `DataArray` with another `DataArray` with some conditions, as I often have to use `.values` for each of them.
Currently I do not have a good idea about how to improve this - I will report back if one occurs to me. Thanks again!
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,173494017
https://github.com/pydata/xarray/issues/987#issuecomment-242912131,https://api.github.com/repos/pydata/xarray/issues/987,242912131,MDEyOklzc3VlQ29tbWVudDI0MjkxMjEzMQ==,4992424,2016-08-27T11:34:28Z,2016-08-27T11:34:28Z,NONE,"@joonro, I think there's a strong case to be made about returning a `DataArray` with some metadata appended. Referring to the latest [draft of the CF Metadata Conventions](http://cfconventions.org/cf-conventions/cf-conventions.html), there is a clear way to indicate when operations such as `mean`, `max`, or `min` have been applied to a variable by using the [**cell_methods**](http://cfconventions.org/cf-conventions/cf-conventions.html#cell-methods) attribute.
It might be more prudent to add this attribute whenever we apply these operations to a `DataArray` (or perhaps variable-wise when applied to a `Dataset`). That way, there is a clear reason to not return a scalar - the documentation of what operations were applied to produce that final result.
I can whip up a working example/pull request if people think this is a direction to go. I'd probably build a decorator which handles inspection of the operator name and arguments and uses that to add the **cell_methods** attribute, that way people can add the same functionality to homegrown methods/operators.
","{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,173494017
https://github.com/pydata/xarray/issues/987#issuecomment-242796865,https://api.github.com/repos/pydata/xarray/issues/987,242796865,MDEyOklzc3VlQ29tbWVudDI0Mjc5Njg2NQ==,1063143,2016-08-26T17:22:06Z,2016-08-26T17:22:06Z,NONE,"I see - thanks a lot for the quick response. I knew there was a good reason for this.
I wonder if it is reasonable to return a scalar when there is neither `coords` nor `attrs` associated with the return value, or it would be too much ad-hoc thing. For example, in the original example the return value was ``, which does not have any useful information.
I think this might be reasonable because I only get into this issue when I'm doing an array-wide operation and I know I'm going to get an aggregate scalar and forget to use `.values`.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,173494017