Skip to content

Request a warning for when coord names are ignored when dims are specified #11234

Closed

Description

@sol-et-stellae

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.

Activity

  1. welcome commented on Mar 16, 2026

    @welcome

    Thanks for opening your first issue here at xarray! Be sure to follow the issue template!
    If you have an idea for a solution, we would really welcome a Pull Request with proposed changes.
    See the Contributing Guide for more.
    It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better.
    Thank you!

  2. added and removed
    needs triageIssue that has not been reviewed by xarray team member
    on Mar 17, 2026
  3. dcherian commented on Mar 17, 2026

    @dcherian
    Contributor

    That is wild. looks like it just treats it as "dict.from_items"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions