Scalars coordinates have no memory on their DataArray
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comienza ejecutando el ejemplo mínimo de xarray y NumPy incluido en el issue y, después, lee la discusión relacionada en el issue #4501. Define cómo debe conservar o exponer un DataArray seleccionado la asociación de coordenadas y añade cobertura de regresión que demuestre el resultado esperado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happened?
I am noticing an issue which might be a bug or a feature, but leaves me quite puzzled. I understand that scalar coordinates are transported all together when slicing/selection is operated to make smooth operations across datasets.
However, when I have a dataset with two variables depending on two different coordinates but sharing a third one, if I operate selection on both the first two coordinates and then select one of the two variable available, I obtain a DataArray where both my coordinates are scalar and there is no way - apparently - to know which coordinate is associated to my DataArray. I tried to provide an example below, and the output looks agnostic to my coordinates y and z. In the example below var1 and var2 have the same dimensions x and the same (scalar) coordinates y and z. Both DataArray could lie on both of coordinate and I have no way to know it without knowing its history.
Thanks for any hint!
What did you expect to happen?
To have an attribute, index or anything else into the final DataArray that helps me to guess what is the coordinate on which my variable depends on. In the example below var1 and var2 have the same dimensions x and the same (scalar) coordinates y and z.
Minimal Complete Verifiable Example
import xarray as xr
import numpy as np
arr = xr.Dataset(
{'var1': (('y', 'x'), np.zeros((1,5))),
'var2': (('z', 'x'), np.zeros((1,5)))},
coords={'y': ('y', [10]), 'z': ('z', [20])})
arr.isel(y=0, z=0)['var1']
Steps to reproduce
No response
MVCE confirmation
- 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
Anything else we need to know?
I checked other issues, the only one that seems relevant is https://github.com/pydata/xarray/issues/4501 but I am not sure I fully understand the implications
Environment
INSTALLED VERSIONS
commit: None
python: 3.14.2 | packaged by conda-forge | (main, Jan 26 2026, 20:19:28) [Clang 20.1.8 ]
python-bits: 64
OS: Darwin
OS-release: 23.6.0
machine: arm64
processor: arm
byteorder: little
LC_ALL: None
LANG: None
LOCALE: (None, 'UTF-8')
libhdf5: 1.14.6
libnetcdf: 4.9.3
xarray: 2025.9.0
pandas: 3.0.0
numpy: 2.3.5
scipy: None
netCDF4: 1.7.4
pydap: None
h5netcdf: None
h5py: None
zarr: None
cftime: 1.6.5
nc_time_axis: None
iris: None
bottleneck: None
dask: 2026.1.1
distributed: None
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
fsspec: 2026.1.0
cupy: None
pint: None
sparse: 0.17.0
flox: None
numpy_groupies: None
setuptools: 80.10.2
pip: 25.3
conda: None
pytest: 9.0.2
mypy: None
IPython: 9.9.0
sphinx: None
- Lenguaje dominante
- Python
- Estrellas
- 4.2k
- Forks
- 1.5k
- Merge medio
- 2 d 21 h
- PR fusionados (30 d)
- 74
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pydata/xarray
-
xarray removes axis grid from pcolormeshPosiblemente ocupada @Sealdot la tomó hoy. Abiertobug needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
`DataTree.map_over_datasets` behavior can be obscure sometimesPosiblemente ocupada @mohansree14 la tomó hace 24 días. Abiertoneeds triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pydata/xarray#11813 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Comparing attrs that contain a dict of NumPy arrays raises ValueError in identical / assert_identicalPosiblemente ocupada @SohamXYZDev la tomó hace 29 días. Abiertobug needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
pydata/xarray#11777 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
RangeIndex` with datetime64 bounds cannot be printed (`Unknown format code 'g'`)Posiblemente ocupada @d-chambers la tomó hace 60 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
pydata/xarray#11598 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
DataTree constructor error message says dict even though dict is not acceptedPosiblemente ocupada @aryansk la tomó hace 100 días. Abiertobug contrib-good-first-issue topic-DataTree topic-error reporting
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
pydata/xarray#11514 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de pydata/xarray
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
abetlen/llama-cpp-python#2424 ·
Los mantenedores suelen responder en 1 día
-
Bug IronPython Python 3
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
pyrevitlabs/pyRevit#4184 ·
Los mantenedores suelen responder en 1 día
-
CLAW (Agents & Orchestration)Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
jqueryscript/awesome-claude-code#1009 ·
-
tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día