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'm less up to speed on the xindex functionality, but a colleagues shared a similar issue to this, so some people are finding their way to them (good news!)
But one issue — it seems like here if we have an index u and v on the u dimension, we can't do something like foo + foo
What did you expect to happen?
Either it works, or — like the old days — it doesn't work but then we shouldn't allow getting the object into that state
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
File~/workspace/xarray/xarray/core/_typed_ops.py:253, inDataArrayOpsMixin.__mul__(self, other)
252def__mul__(self, other: DaCompatible) ->Self:
-->253returnself._binary_op(other, operator.mul)
File~/workspace/xarray/xarray/core/dataarray.py:4747, inDataArray._binary_op(self, other, f, reflexive)
4745ifisinstance(other, DataArray):
4746align_type=OPTIONS["arithmetic_join"]
->4747self, other=align(self, other, join=align_type, copy=False)
4748other_variable_or_arraylike: DaCompatible=getattr(other, "variable", other)
4749other_coords=getattr(other, "coords", None)
File~/workspace/xarray/xarray/core/alignment.py:887, inalign(join, copy, indexes, exclude, fill_value, *objects)
691""" 692 Given any number of Dataset and/or DataArray objects, returns new 693 objects with aligned indexes and dimension sizes. (...) 877 878 """879aligner=Aligner(
880objects,
881join=join,
(...)
885fill_value=fill_value,
886 )
-->887aligner.align()
888returnaligner.resultsFile~/workspace/xarray/xarray/core/alignment.py:578, inAligner.align(self)
576self.find_matching_indexes()
577self.find_matching_unindexed_dims()
-->578self.assert_no_index_conflict()
579self.align_indexes()
580self.assert_unindexed_dim_sizes_equal()
File~/workspace/xarray/xarray/core/alignment.py:322, inAligner.assert_no_index_conflict(self)
318pprint(self.indexes)
319items_msg=", ".join(
320f"{k!r} ({v} conflicting indexes)"fork, vindup.items()
321 )
-->322raiseValueError(
323"cannot re-index or align objects with conflicting indexes found for "324f"the following {msg}: {items_msg}\n"325"Conflicting indexes may occur when\n"326"- they relate to different sets of coordinate and/or dimension names\n"327"- they don't have the same type\n"328"- they may be used to reindex data along common dimensions"329 )
ValueError: cannotre-indexoralignobjectswithconflictingindexesfoundforthefollowingdimensions: 'u' (2conflictingindexes)
Conflictingindexesmayoccurwhen-theyrelatetodifferentsetsofcoordinateand/ordimensionnames-theydon'thavethesametype-theymaybeusedtoreindexdataalongcommondimensions
max-sixty
changed the title
Objects with multiple identical xindexs aren't alignable
Objects with multiple identical xindexs on a dim aren't alignable
Sep 10, 2024
What happened?
I'm less up to speed on the
xindex
functionality, but a colleagues shared a similar issue to this, so some people are finding their way to them (good news!)But one issue — it seems like here if we have an index
u
andv
on theu
dimension, we can't do something likefoo + foo
What did you expect to happen?
Either it works, or — like the old days — it doesn't work but then we shouldn't allow getting the object into that state
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
No response
Environment
INSTALLED VERSIONS
commit: 9735216
python: 3.11.10 (main, Sep 7 2024, 01:03:31) [Clang 15.0.0 (clang-1500.3.9.4)]
python-bits: 64
OS: Darwin
OS-release: 23.6.0
machine: arm64
processor: arm
byteorder: little
LC_ALL: None
LANG: None
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.14.3
libnetcdf: 4.9.2
xarray: 2024.7.1.dev68+gcc74d3ae
pandas: 2.2.2
numpy: 2.0.2
scipy: 1.14.1
netCDF4: 1.7.1.post2
pydap: None
h5netcdf: 1.3.0
h5py: 3.11.0
zarr: 2.18.3
cftime: 1.6.4
nc_time_axis: 1.4.1
iris: None
bottleneck: 1.4.0
dask: 2024.8.2
distributed: 2024.8.2
matplotlib: 3.9.2
cartopy: None
seaborn: 0.13.2
numbagg: 0.8.1
fsspec: 2024.9.0
cupy: None
pint: None
sparse: None
flox: 0.9.11
numpy_groupies: 0.11.2
setuptools: 69.2.0
pip: 24.0
conda: None
pytest: 8.3.3
mypy: 1.11.2
IPython: 8.24
The text was updated successfully, but these errors were encountered: