You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried a DataArray with more than one dimension coordinate. Unfortunately xr.align fails, which disallows any arithmetic operation - even when the coords are exactly the same.
Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
Complete example — the example is self-contained, including all data and the text of any traceback.
Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
New issue — a search of GitHub Issues suggests this is not a duplicate.
Recent environment — the issue occurs with the latest version of xarray and its dependencies.
Relevant log output
---------------------------------------------------------------------------ValueErrorTraceback (mostrecentcalllast)
/home/mathause/code/mesmer/devel/prepare_for_surfer.ipynbCell28line112da=xr.DataArray(data, dims=("y", "x"), coords={"x": x, "y": y, "s": ("y", s)})
13da=da.set_xindex("s")
--->15xr.align(da, da.y) # errors17da+da.x# errorsFile~/.conda/envs/mesmer_dev/lib/python3.9/site-packages/xarray/core/alignment.py:888, inalign(join, copy, indexes, exclude, fill_value, *objects)
692""" 693 Given any number of Dataset and/or DataArray objects, returns new 694 objects with aligned indexes and dimension sizes.ref='~/.conda/envs/mesmer_dev/lib/python3.9/site-packages/xarray/core/alignment.py:0'>0</a>;32m (...) 878 879 """880aligner=Aligner(
881objects,
882join=join,
ref='~/.conda/envs/mesmer_dev/lib/python3.9/site-packages/xarray/core/alignment.py:0'>0</a>;32m (...)
886fill_value=fill_value,
887 )
-->888aligner.align()
889returnaligner.resultsFile~/.conda/envs/mesmer_dev/lib/python3.9/site-packages/xarray/core/alignment.py:573, inAligner.align(self)
571self.find_matching_indexes()
572self.find_matching_unindexed_dims()
-->573self.assert_no_index_conflict()
574self.align_indexes()
575self.assert_unindexed_dim_sizes_equal()
File~/.conda/envs/mesmer_dev/lib/python3.9/site-packages/xarray/core/alignment.py:318, inAligner.assert_no_index_conflict(self)
314ifdup:
315items_msg=", ".join(
316f"{k!r} ({v} conflicting indexes)"fork, vindup.items()
317 )
-->318raiseValueError(
319"cannot re-index or align objects with conflicting indexes found for "320f"the following {msg}: {items_msg}\n"321"Conflicting indexes may occur when\n"322"- they relate to different sets of coordinate and/or dimension names\n"323"- they don't have the same type\n"324"- they may be used to reindex data along common dimensions"325 )
ValueError: cannotre-indexoralignobjectswithconflictingindexesfoundforthefollowingdimensions: 'y' (2conflictingindexes)
Conflictingindexesmayoccurwhen-theyrelatetodifferentsetsofcoordinateand/ordimensionnames-theydon'thavethesametype-theymaybeusedtoreindexdataalongcommondimensions
Anything else we need to know?
No response
Environment
INSTALLED VERSIONS
commit: feba698
python: 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0]
python-bits: 64
OS: Linux
OS-release: 6.2.0-36-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.14.2
libnetcdf: 4.9.2
What happened?
I tried a DataArray with more than one dimension coordinate. Unfortunately
xr.align
fails, which disallows any arithmetic operation - even when the coords are exactly the same.What did you expect to happen?
No response
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
No response
Environment
INSTALLED VERSIONS
commit: feba698
python: 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0]
python-bits: 64
OS: Linux
OS-release: 6.2.0-36-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.14.2
libnetcdf: 4.9.2
xarray: 2023.9.1.dev8+gf6d69a1f
pandas: 2.1.1
numpy: 1.24.4
scipy: 1.11.3
netCDF4: 1.6.4
pydap: installed
h5netcdf: 1.2.0
h5py: 3.9.0
Nio: None
zarr: 2.16.1
cftime: 1.6.2
nc_time_axis: 1.4.1
PseudoNetCDF: 3.2.2
iris: 3.7.0
bottleneck: 1.3.7
dask: 2023.9.2
distributed: None
matplotlib: 3.8.0
cartopy: 0.22.0
seaborn: 0.12.2
numbagg: 0.2.2
fsspec: 2023.9.2
cupy: None
pint: 0.20.1
sparse: 0.14.0
flox: 0.7.2
numpy_groupies: 0.10.1
setuptools: 68.2.2
pip: 23.2.1
conda: None
pytest: 7.4.2
mypy: 1.5.1
IPython: 8.15.0
sphinx: None
The text was updated successfully, but these errors were encountered: