Skip to content

fix: keep unset p_set as NaN in cluster_heat_buses aggregation#2202

Open
lkstrp wants to merge 3 commits into
masterfrom
fix/cluster-p-set
Open

fix: keep unset p_set as NaN in cluster_heat_buses aggregation#2202
lkstrp wants to merge 3 commits into
masterfrom
fix/cluster-p-set

Conversation

@lkstrp

@lkstrp lkstrp commented Jun 12, 2026

Copy link
Copy Markdown
Member

Closes #2182

See PyPSA/PyPSA#1703

@lkstrp lkstrp requested a review from FabianHofmann June 12, 2026 09:47

@FabianHofmann FabianHofmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great! feel free to ignore or tackle the comment. In the long term we should consolidate clustering techniques (but out of scope here)

Comment on lines +5698 to +5703
def _sum_keep_na(s):
"""
Sum keeping all-NaN groups as NaN instead of collapsing them to 0.

"""
return s.sum(min_count=1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather in helpers.py?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess everywhere else you should rather just pass s.sum(min_count=1) directly

@lkstrp lkstrp enabled auto-merge (squash) June 12, 2026 09:54
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.

cluster_heat_buses silently sets p_set=0.0 on every clustered Generator/Link/Store via NaN-summing aggregation

2 participants