Skip to content

Fix align(join="override") copying index attrs and encoding across objects - #11990

Open
pierceluu10 wants to merge 2 commits into
pydata:mainfrom
pierceluu10:fix/align-override-attrs
Open

pierceluu10 wants to merge 2 commits into
pydata:mainfrom
pierceluu10:fix/align-override-attrs

Conversation

@pierceluu10

Copy link
Copy Markdown

Description

Problem

With join="override", align copied the first object's index variables into every other object, including their attrs and encoding. The result:

  • DataArrays ended up with the first object's attrs.
  • Datasets ended up with both sets of attrs merged.

Fix

Each object now keeps the attrs and encoding of its own index variable, which matches what join="inner" already does. Only the index values are overridden. copy=True and copy=False behave as before.

Tests

Extended test_align_index_var_attrs to cover:

  • Dataset and DataArray
  • attrs and encoding
  • both argument orders

Checklist

AI Disclosure

  • This PR contains AI-generated content.

pierceluu10 and others added 2 commits December 4, 2026 18:07
…ide"

Aligner.override_indexes copied the first object's index variables into
every other object, so DataArrays got the first object's attrs and encoding
and Datasets got both merged. Take attrs and encoding from each object's
own matching index variable instead, as join="inner" or "left" do.

Closes pydata#6860

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align with join='override' may update index coordinate metadata

1 participant