Request a warning for when coord names are ignored when dims are specified
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
What is your issue?
When coords are specified in tuple format, their names are silently ignored when dims names are also specified.
The following expression yields a DataArray that retains no reference to the otherwise specified coords of a, b, and c, in favor of the positionally-associated names of dims, x, y, and z.
DataArray(
data=[[[1]], [[2]], [[3]]],
dims=["x", "y", "z"],
coords=[("a", [5, 6, 7]), ("b", [8]), ("c", [9])]
)
The result is:
<xarray.DataArray (x: 3, y: 1, z: 1)> Size: 24B
array([[[1]],
[[2]],
[[3]]])
Coordinates:
* x (x) int64 24B 5 6 7
* y (y) int64 8B 8
* z (z) int64 8B 9
Even though this behavior is documented, I think the user should be warned that the coordinate names do not match the dimension names and have been overridden.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the DataArray expression in the issue and trace the constructor path that handles tuple-form coords alongside explicit dims. Add a regression test for the mismatched names and verify that the resulting warning is emitted while the documented positional behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100