issues: 1915876808
This data as json
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1915876808 | I_kwDOAMm_X85yMfXI | 8236 | DataArray with multiple (Pandas)Indexes on the same dimension is impossible to align | 43316012 | closed | 0 | 3 | 2023-09-27T15:52:05Z | 2023-10-02T06:53:27Z | 2023-10-01T07:19:09Z | COLLABORATOR | What happened?I have a DataArray with a single dimension and multiple (Pandas)Indexes assigned to various coordinates for efficient indexing using sel. Edit: the problem is even worse than originally described below: such a DataArray breaks all alignment and it's basically unusable... When I try to add an additional coordinate without any index (I simply use the tuple[dimension, values] way) I get a ValueError about aligning with conflicting indexes. If the original DataArray only has a single (Pandas)Index everything works as expected. What did you expect to happen?I expected that I can simply assign new coordinates without an index. Minimal Complete Verifiable Example```Python import xarray as xr da = xr.DataArray( [1, 2, 3], dims="t", coords={ "a": ("t", [3, 4, 5]), "b": ("t", [5, 6, 7]) } ) set one indexda2 = da.set_xindex("a") set second index (same dimension, maybe thats a problem?)da3 = da2.set_xindex("b") this worksda2.coords["c"] = ("t", [2, 3, 4]) this does notda3.coords["c"] = ("t", [2, 3, 4]) ``` MVCE confirmation
Relevant log output
Anything else we need to know?No response Environment
INSTALLED VERSIONS
------------------
commit: None
python: 3.9.10 (main, Mar 21 2022, 13:08:11)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
python-bits: 64
OS: Linux
OS-release: 3.10.0-1160.66.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.2
libnetcdf: 4.9.0
xarray: 2022.12.0
pandas: 2.0.2
numpy: 1.24.3
scipy: 1.10.0
netCDF4: 1.6.2
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.6.2
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: 3.6.3
cartopy: None
seaborn: None
numbagg: None
fsspec: None
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 58.1.0
pip: 21.2.4
conda: None
pytest: 7.3.2
mypy: 1.0.0
IPython: 8.8.0
sphinx: None
I have not yet tried this with a newer version of xarray.... |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/8236/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
not_planned | 13221727 | issue |