Skip to content

Preserve coordinates after non-leading-dimension groupby reductions#11290

Open
officialasishkumar wants to merge 1 commit intopydata:mainfrom
officialasishkumar:fix-11188-groupby-preserve-coords
Open

Preserve coordinates after non-leading-dimension groupby reductions#11290
officialasishkumar wants to merge 1 commit intopydata:mainfrom
officialasishkumar:fix-11188-groupby-preserve-coords

Conversation

@officialasishkumar
Copy link
Copy Markdown

Description

Fallback groupby reductions can reorder variable dimensions before DataArray._replace_maybe_drop_dims filters coordinates. That path still zipped shapes against the original dimension order, which dropped unrelated coordinates when the reordered dimensions had different lengths.

This switches that branch to use variable.sizes and adds regression coverage for both the helper and the user-visible groupby behavior.

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
      Tools: Codex

Use the reordered variable sizes when deciding which coordinates survive _replace_maybe_drop_dims, and add regression coverage for both the internal helper and groupby behavior.
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.

DataArray.groupby drops empty coordinates

1 participant