-
Notifications
You must be signed in to change notification settings - Fork 9
Feature: Clustering IO, single selection, and weights API improvements #549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
FBumann
merged 13 commits into
feature/aggregate-rework-v2
from
feature/sel+isel+cluster-io
Jan 3, 2026
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
aef3fc3
Enable selecting a single period/scenario
FBumann 61a451f
No selected_* tracking
FBumann 4e90a59
Clustering IO
FBumann c7b6afe
Clustering IO
FBumann 120d544
Improve IO
FBumann f67edb9
Improve validation
FBumann 6de9107
Merge branch 'feature/aggregate-rework-v2' into feature/sel+isel+clus…
FBumann ca53972
Fix cluster weight IO
FBumann df0f6a0
Fix cluster weights stuff
FBumann 0e38cc2
Fix cluster weights stuff
FBumann cb01345
Refactor weights API: always normalize scenario weights (#547)
FBumann d977149
Update CHANGELOG.md
FBumann 2b698c0
1. ClusterStructure.n_clusters naming - Added explicit rename (matc…
FBumann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix
validate()whencluster_structure.n_clustersis a DataArray and guard cluster dim assumptions.Two things here can cause runtime errors depending on how clustering backends populate
cluster_structure:n_clusters = self.cluster_structure.n_clustersfollowed byif weights_n_clusters != n_clusters:will break whenn_clustersis anxr.DataArray(the comparison yields a DataArray andif ...raises an ambiguity error). Coerce to a Python int first, as done elsewhere:Later,
weight_sum_per_slice = self.representative_weights.sum(dim='cluster')assumes a'cluster'dimension whenevercluster_structureis present. Ifrepresentative_weightsis created in a flat time‑only form for some backends, this will raise a KeyError. Either enforce'cluster'inrepresentative_weights.dimsat construction time or short‑circuit/raise a clearer error here if'cluster'is missing.These issues are correctness problems once
n_clustersis provided as a DataArray or if a backend supplies non‑clustered weights alongside acluster_structure.