Skip to content

sortby(dim) removes dimension from an array if dim is a repeated dimension #2579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
floogit opened this issue Nov 28, 2018 · 1 comment
Closed

Comments

@floogit
Copy link

floogit commented Nov 28, 2018

Related to #1378. As mentioned there, xarray sometimes seems to have problems with repeated dimensions. sortby() such a dimension seems to be an example:

ds = xr.DataArray(np.eye(2), coords={'alt': [100, 200], 'alt': [100, 200], }, 
    dims=('alt', 'alt'), name='cov').to_dataset()

print(ds)
<xarray.Dataset>
Dimensions:  (alt: 2)
Coordinates:
  * alt      (alt) int64 100 200
Data variables:
    cov      (alt, alt) float64 1.0 0.0 0.0 1.0

print(ds.sortby('alt'))
<xarray.Dataset>
Dimensions:  (alt: 2)
Coordinates:
  * alt      (alt) int64 100 200
Data variables:
    cov      (alt) float64 1.0 1.0

Output of xr.show_versions()

commit: None
python: 2.7.13.final.0
python-bits: 64
OS: Linux
OS-release: 4.9.0-8-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

xarray: 0.10.9
pandas: 0.23.4
numpy: 1.15.4
scipy: 1.1.0
netCDF4: 1.2.8
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.0.0
PseudonetCDF: None
rasterio: 0.36.0
iris: None
bottleneck: 1.2.1
cyordereddict: 1.0.0
dask: 0.20.2
distributed: None
matplotlib: 2.2.3
cartopy: 0.16.0
seaborn: 0.8.1
setuptools: 39.2.0
pip: 18.1
conda: None
pytest: 3.8.0
IPython: 5.8.0
sphinx: None

@shoyer
Copy link
Member

shoyer commented Nov 28, 2018

Thanks for the report. Let's consolidate discussion over in #1378. Help would definitely be appreciated on this -- a great start would be more comprehensive tests (we could merge them marked as xfail).

@shoyer shoyer closed this as completed Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants