id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 787847449,MDU6SXNzdWU3ODc4NDc0NDk=,4821,Error when supplying a tuple of dimensions to DataArray.sortby(),5158900,open,0,,,18,2021-01-18T01:22:08Z,2021-06-13T17:28:13Z,,NONE,,,," **What happened**: A KeyError is thrown when supplying a tuple of dimensions to DataArray.sortby() **What you expected to happen**: The dataarray to be sorted according to the dimensions. **Minimal Complete Verifiable Example**: ```python import xarray as xr import numpy as np da=xr.DataArray(np.random.rand(3,3), coords=(('x', range(3, 0, -1)), ('y', range(3, 0, -1)))) da.sortby(da.dims) ``` **Anything else we need to know?**: If the tuple is cast to a list it works correctly: ```python da.sortby(list(da.dims)) ``` **Environment**:
Output of xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.6.12 (default, Nov 11 2020, 22:22:08) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)] python-bits: 64 OS: Darwin OS-release: 18.7.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: None LOCALE: en_US.UTF-8 libhdf5: None libnetcdf: None xarray: 0.16.2 pandas: 1.1.4 numpy: 1.19.4 scipy: 1.5.4 netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.2 dask: 2020.12.0 distributed: None matplotlib: 3.3.3 cartopy: None seaborn: None numbagg: None pint: None setuptools: 50.3.2 pip: 20.3.3 conda: None pytest: 6.2.1 IPython: 7.16.1 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4821/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue