issues: 1415592761
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1415592761 | I_kwDOAMm_X85UYDs5 | 7189 | combine_by_coords allows one overlapping coordinate value, but not more than one | 4502 | open | 0 | 1 | 2022-10-19T21:13:28Z | 2022-10-20T16:40:57Z | NONE | What happened?I expected combine_by_coords to explicitly reject all cases where the coordinates overlap, producing a ValueError in cases like the following with coords
As well as cases with larger overlaps e.g. What did you expect to happen?It fails to reject the case above with coordinates Minimal Complete Verifiable Example```Python This overlap is caught, as expecteda = xarray.DataArray(dims=('x',), data=np.ones((3,)), coords={'x': [0, 1, 2]}) b = xarray.DataArray(dims=('x',), data=np.ones((3,)), coords={'x': [1, 2, 3]}) xarray.combine_by_coords([a, b]) => ValueError: Resulting object does not have monotonic global indexes along dimension x This overlap is not caughta = xarray.DataArray(dims=('x',), data=np.ones((2,)), coords={'x': [0, 1]}) b = xarray.DataArray(dims=('x',), data=np.ones((2,)), coords={'x': [1, 2]}) xarray.combine_by_coords([a, b]) => <xarray.DataArray (x: 4)> array([1., 1., 1., 1.]) Coordinates: * x (x) int64 0 1 1 2 ``` MVCE confirmation
Relevant log outputNo response Anything else we need to know?As far as I can tell this happens because I assume it wasn't intentional to allow overlaps like this. If so, do you think anyone is depending on this (I'd hope not...) and would you take a PR to fix it to produce a ValueError in this case? If this behaviour is intentional or relied upon, could we have an option to do a strict check instead? Also for performance reasons I'd propose to do some extra upfront checks to catch index overlap (e.g. by checking for index overlap in Environment
INSTALLED VERSIONS
------------------
commit: None
python: 3.9.15 (stable, redacted, redacted)
[Clang google3-trunk (11897708c0229c92802e747564e7c34b722f045f)]
python-bits: 64
OS: Linux
OS-release: 5.18.16-1rodete1-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.1
libnetcdf: None
xarray: 2022.06.0
pandas: 1.1.5
numpy: 1.23.2
scipy: 1.8.1
netCDF4: None
pydap: None
h5netcdf: None
h5py: 3.2.1
Nio: None
zarr: 2.7.0
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: 3.3.4
cartopy: None
seaborn: 0.11.2
numbagg: None
fsspec: 0.7.4
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: None
pip: None
conda: None
pytest: None
IPython: 3.2.3
sphinx: None
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/7189/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |