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/1081#issuecomment-544416092,https://api.github.com/repos/pydata/xarray/issues/1081,544416092,MDEyOklzc3VlQ29tbWVudDU0NDQxNjA5Mg==,6213168,2019-10-21T08:51:10Z,2019-10-21T08:51:23Z,MEMBER,"+1 for (2). Although user code that uses ... should not, by definition, care about the order of the variables that are not listed explicitly.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-544363547,https://api.github.com/repos/pydata/xarray/issues/1081,544363547,MDEyOklzc3VlQ29tbWVudDU0NDM2MzU0Nw==,1217238,2019-10-21T06:09:40Z,2019-10-21T06:09:40Z,MEMBER,"I agree, I think (2) is what most users would expect.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-544358202,https://api.github.com/repos/pydata/xarray/issues/1081,544358202,MDEyOklzc3VlQ29tbWVudDU0NDM1ODIwMg==,5635139,2019-10-21T05:46:19Z,2019-10-21T05:46:19Z,MEMBER,"I would vote for (2), given it's fairly easy to replicate (1) by passing the full list, and I think (2) is arguably slightly more expected
(NB this isn't how #3421 works now, but easy to change)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-544350457,https://api.github.com/repos/pydata/xarray/issues/1081,544350457,MDEyOklzc3VlQ29tbWVudDU0NDM1MDQ1Nw==,1217238,2019-10-21T05:06:02Z,2019-10-21T05:06:02Z,MEMBER,"There's one edge case that might be worth thinking carefully about here:
Consider a dataset with two variables with dimensions `('w', 'x', 'y', 'z')` and `('x', 'w', 'y', 'z')`. Now we write `.transpose(..., 'z', 'y')`. What should the dimensions of variables on the resulting dataset be?
1. Both `('w', 'x', 'z', 'y')`, with `...` filled in based on the order of dimensions in the overall dataset.
2. `('w', 'x', 'y', 'z')` and `('x', 'w', 'y', 'z')`, with `...` filled in for each variable separately.","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-540678758,https://api.github.com/repos/pydata/xarray/issues/1081,540678758,MDEyOklzc3VlQ29tbWVudDU0MDY3ODc1OA==,1217238,2019-10-10T16:58:59Z,2019-10-10T16:58:59Z,MEMBER,"Yes, this looks like a great use-case for Ellipsis!
On Thu, Oct 10, 2019 at 2:12 AM crusaderky wrote:
> From personal experience I find that 99% of the time, I want to push some
> known dimensions either to the front or to the back of the array while I
> don't care about the order of the others.
> I'd love to have this syntax:
>
> transpose(..., ""x"", ""y"")
>
> or
>
> transpose(""x"", ""y"", ...)
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> ,
> or unsubscribe
>
> .
>
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-540477534,https://api.github.com/repos/pydata/xarray/issues/1081,540477534,MDEyOklzc3VlQ29tbWVudDU0MDQ3NzUzNA==,6213168,2019-10-10T09:12:46Z,2019-10-10T09:14:28Z,MEMBER,"From personal experience I find that 99% of the time, I want to push some known dimensions either to the front or to the back of the array while I don't care about the order of the others.
I'd love to have this syntax:
```python
transpose(..., ""x"", ""y"")
```
or
```python
transpose(""x"", ""y"", ...)
```
where the ellipsis expands to all dimensions not explicitly listed, in their original order. There can be at most one ellipsis.","{""total_count"": 5, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 5, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-540140051,https://api.github.com/repos/pydata/xarray/issues/1081,540140051,MDEyOklzc3VlQ29tbWVudDU0MDE0MDA1MQ==,26384082,2019-10-09T18:54:16Z,2019-10-09T18:54:16Z,NONE,"In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity
If this issue remains relevant, please comment here or remove the `stale` label; otherwise it will be marked as closed automatically
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-342906368,https://api.github.com/repos/pydata/xarray/issues/1081,342906368,MDEyOklzc3VlQ29tbWVudDM0MjkwNjM2OA==,1217238,2017-11-08T18:14:56Z,2017-11-08T18:14:56Z,MEMBER,"`tranpose('x', 'y')` already means ensure this object has dimensions in the order (x, y):
```
In [2]: a = xarray.DataArray([[0]], dims=['x', 'y'])
In [3]: a.T
Out[3]:
array([[0]])
Dimensions without coordinates: y, x
In [4]: a.T.transpose('x', 'y')
Out[4]:
array([[0]])
Dimensions without coordinates: x, y
In [5]: a.transpose('x', 'y')
Out[5]:
array([[0]])
Dimensions without coordinates: x, y
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-342898298,https://api.github.com/repos/pydata/xarray/issues/1081,342898298,MDEyOklzc3VlQ29tbWVudDM0Mjg5ODI5OA==,5635139,2017-11-08T17:48:20Z,2017-11-08T17:48:20Z,MEMBER,"> ds.transpose('lat', 'lon') seems pretty unambiguous.
Though I think that would have radically different behavior for a 2-dim or 3-dim case. For the 2-dim case, it would enforce that order regardless of original order. For the 3-dim case, are you proposing they're swapped from their current order?
(Maybe `transpose` naturally refers to the behavior I think you describe, we'd need something else to 'set this order')","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-342892003,https://api.github.com/repos/pydata/xarray/issues/1081,342892003,MDEyOklzc3VlQ29tbWVudDM0Mjg5MjAwMw==,1217238,2017-11-08T17:27:06Z,2017-11-08T17:27:06Z,MEMBER,"What about allowing `.transpose()` to handle a subset of array/dataset dimensions? In NumPy, this may not be desirable because it's easy to mix up integer dimensions, but in xarray `ds.transpose('lat', 'lon')` seems pretty unambiguous.
The implementation would simply reorder all the listed dimensions, keeping other dimensions in their original order.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-323880231,https://api.github.com/repos/pydata/xarray/issues/1081,323880231,MDEyOklzc3VlQ29tbWVudDMyMzg4MDIzMQ==,7799184,2017-08-21T23:44:30Z,2017-08-21T23:56:54Z,CONTRIBUTOR,"I have also hit this issue, this method could be useful. I'm putting below my workaround in case it is any helpful:
```python
def reorder_dims(darray, dim1, dim2):
""""""
Interchange two dimensions of a DataArray in a similar way as numpy's swap_axes
""""""
dims = list(darray.dims)
assert set([dim1,dim2]).issubset(dims), 'dim1 and dim2 must be existing dimensions in darray'
ind1, ind2 = dims.index(dim1), dims.index(dim2)
dims[ind2], dims[ind1] = dims[ind1], dims[ind2]
return darray.transpose(*dims)
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-258533613,https://api.github.com/repos/pydata/xarray/issues/1081,258533613,MDEyOklzc3VlQ29tbWVudDI1ODUzMzYxMw==,1217238,2016-11-04T20:03:15Z,2016-11-04T20:03:15Z,MEMBER,"> `reorder_dims`?
Would that be consistent with `reorder_levels` for MultIindex (#1028)? I'm not sure if that handles partial order specifications or not.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-258531906,https://api.github.com/repos/pydata/xarray/issues/1081,258531906,MDEyOklzc3VlQ29tbWVudDI1ODUzMTkwNg==,1197350,2016-11-04T19:55:38Z,2016-11-04T19:55:38Z,MEMBER,"I have hit this issue before too.
> We could add a method like numpy's `swap_axes`, it's just not clear what to name it.
`reorder_dims`?
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-258531525,https://api.github.com/repos/pydata/xarray/issues/1081,258531525,MDEyOklzc3VlQ29tbWVudDI1ODUzMTUyNQ==,6420873,2016-11-04T19:53:49Z,2016-11-04T19:53:49Z,NONE,"Thanks! I will check it.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-258530895,https://api.github.com/repos/pydata/xarray/issues/1081,258530895,MDEyOklzc3VlQ29tbWVudDI1ODUzMDg5NQ==,1217238,2016-11-04T19:50:54Z,2016-11-04T19:50:54Z,MEMBER,"You need to provide the full list of dimensions to `transpose`.
We could add a method like numpy's `swap_axes`, it's just not clear what to name it.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-258530348,https://api.github.com/repos/pydata/xarray/issues/1081,258530348,MDEyOklzc3VlQ29tbWVudDI1ODUzMDM0OA==,6420873,2016-11-04T19:48:20Z,2016-11-04T19:48:20Z,NONE,"Thanks, @shoyer
I agree your methods works for 2d matrix, but for 3 or 4d matrix it fails.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785
https://github.com/pydata/xarray/issues/1081#issuecomment-258529683,https://api.github.com/repos/pydata/xarray/issues/1081,258529683,MDEyOklzc3VlQ29tbWVudDI1ODUyOTY4Mw==,1217238,2016-11-04T19:45:14Z,2016-11-04T19:45:14Z,MEMBER,"`swap_dims` does something very different from `swap_axes` in numpy (we should add an example to make this clear).
For what you want, I think `transpose` is a closer fit, e.g., `foo.transpose('lon', 'lat')`
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,187393785