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/967#issuecomment-298109506,https://api.github.com/repos/pydata/xarray/issues/967,298109506,MDEyOklzc3VlQ29tbWVudDI5ODEwOTUwNg==,5572303,2017-04-28T21:20:57Z,2017-04-28T21:20:57Z,CONTRIBUTOR,"Sounds good. As I'm writing the type-checking code I run into this question: Why would I have a `xarray.core.dataset.DataVariables` object as input? A DataVariables object could contain multiple DataArrays, which makes the interpretation a bit unclear. In my mind it should only be 1.) name(s) of existing index coords, or 2.) 1D DataArray(s) with dim in `self.dims`","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,171077425
https://github.com/pydata/xarray/issues/967#issuecomment-297875052,https://api.github.com/repos/pydata/xarray/issues/967,297875052,MDEyOklzc3VlQ29tbWVudDI5Nzg3NTA1Mg==,5572303,2017-04-28T00:27:46Z,2017-04-28T00:27:46Z,CONTRIBUTOR,"What would the signature of `sortby()` be then? On our end we just want a more intuitive way to sort by dimension labels, so now I have `sort_index(self, dims, ascending=True)`. `sortby()`, based on your description, seems like a separate method. Or any suggestion on how we can marry the two into something coherent?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,171077425
https://github.com/pydata/xarray/issues/967#issuecomment-297868909,https://api.github.com/repos/pydata/xarray/issues/967,297868909,MDEyOklzc3VlQ29tbWVudDI5Nzg2ODkwOQ==,5572303,2017-04-27T23:43:12Z,2017-04-27T23:43:12Z,CONTRIBUTOR,"A couple of things:
1.) Upon a little thinking I believe `sort_values()` doesn't make much sense, so I'm only working on `sort_index()'.
2.) the way I handle the `inplace` kwarg is by
```
if inplace:
self = self.isel(**{d: self.indexes[d].argsort()
if ascending
else self.indexes[d].argsort()[::-1]
for d in dimensions})
else:
return self.isel(**{d: self.indexes[d].argsort()
if ascending
else self.indexes[d].argsort()[::-1]
for d in dimensions})
```
But when I run
```
ds.sort_index(dims=['x', 'y'], inplace=True)
```
nothing changes. If I put a `pdb.set_trace()` right below the self = self*** I can evaluate self and see that it's what I want it to be. But somehow that assignment is not realized to the higher level. Any quick pointer?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,171077425
https://github.com/pydata/xarray/issues/967#issuecomment-296394094,https://api.github.com/repos/pydata/xarray/issues/967,296394094,MDEyOklzc3VlQ29tbWVudDI5NjM5NDA5NA==,5572303,2017-04-22T18:57:07Z,2017-04-22T18:57:07Z,CONTRIBUTOR,"On our end, we currently do the following when we need to sort by axis label (lat/lon in this case):
```
da.reindex(indexers={'lat':sorted(da.coords['lat'].values), 'lon':sorted(da.coords['lon'].values)})
```
Upon first glance of the source code I think our approach goes down different code path than your `.isel()` approach. The most obvious difference, from a user's stand point, is probably that `.reindex()` returns a new object, whereas `.isel()` returns a view (typically). In Pandas, both `sort_index()` and `sort_values()` seem to return new objects.
We'd be happy to contribute to an xarray version of `sort_index()` and `sort_values()`. The first question is, which one would be the more robust and computationally efficient code path to take?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,171077425