issues: 2204768593
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2204768593 | I_kwDOAMm_X86DahlR | 8871 | Concatenation automatically creates indexes where none existed | 35968931 | open | 0 | 1 | 2024-03-25T02:43:31Z | 2024-04-27T16:50:56Z | MEMBER | What happened?Currently concatenation will automatically create indexes for any dimension coordinates in the output, even if there were no indexes on the input. What did you expect to happen?Indexes not to be created for variables which did not already have them. Minimal Complete Verifiable Example```Python TODO once passing indexes={} directly to DataArray constructor is allowed then no need to create coords object separately firstcoords = Coordinates( {"x": np.array([1, 2, 3])}, indexes={} ) arrays = [ DataArray( np.zeros((3, 3)), dims=["x", "y"], coords=coords, ) for _ in range(2) ] combined = concat(arrays, dim="x") assert combined.shape == (6, 3) assert combined.dims == ("x", "y") should not have auto-created any indexesassert combined.indexes == {} # this fails combined = concat(arrays, dim="z") assert combined.shape == (2, 3, 3) assert combined.dims == ("z", "x", "y") should not have auto-created any indexesassert combined.indexes == {} # this also fails ``` MVCE confirmation
Relevant log output```Python nor have auto-created any indexes
Anything else we need to know?The culprit is the call to I would like know to how to avoid the internal call to Conceptually, I would have thought we should be examining what indexes exist on the objects to be concatenated, and not creating new indexes for any variable that doesn't already have one. Presumably we should therefore be making use of the EnvironmentI've been experimenting running this test on a branch that includes both #8711 and #8714, but actually this example will fail in the same way on |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/8871/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |