Fix new entrant renaming - #144
Open
EllieKallmier wants to merge 1 commit into
Open
EllieKallmier wants to merge 1 commit into
EllieKallmier wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
EllieKallmier
force-pushed
the
fix-new-entrant-renaming
branch
from
September 14, 2026 05:42
39e2bf0 to
0a9569e
Compare
EllieKallmier
marked this pull request as ready for review
September 14, 2026 05:50
Member
|
Hey Ellie - As discussed - perhaps could expand this out / make it slightly more readable? return new_entrants.groupby(
group_key_columns + ["geo_id"], dropna=False, as_index=False
).agg({"name": "first", **{col: "mean" for col in value_columns}})Something like: name_aggregation_rule = {"name": "first"}
value_column_aggregation_rules = {col: "mean" for col in value_columns}
return new_entrants.groupby(
group_key_columns + ["geo_id"], dropna=False, as_index=False
).agg(name_aggregation_rule | value_aggregation_rules)Or variation of .. Also maybe move :
From Otherwise looks good! |
nick-gorman
approved these changes
Sep 28, 2026
| value_columns: list[str], | ||
| ) -> pd.DataFrame: | ||
| """Groups by ``group_key_columns`` + 'geo_id' and averages ``value_columns``.""" | ||
| # 'dropna=False' set to keep thermal generator rows (w/ NaN 'resource_type') |
Member
There was a problem hiding this comment.
Was this comment incorrect?
|
|
||
| # Allowed 'extra' subregion (not in sub_regional_geography) present in the names of | ||
| # some new entrant gas plant; see Open-ISP/ISPyPSA#131 | ||
| _EXTRA_SUBREGION_IN_NAMES = {"WOO"} |
Member
There was a problem hiding this comment.
Not sure that the tests cover this? i.e. that might all pass fine even without it.
Member
There was a problem hiding this comment.
Actually if you make Dylan change move set(old_geo_ids) | _EXTRA_SUBREGION_IN_NAMES then I think the test you added would then cover this.
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reworked the new entrants' renaming after regional granularity collapse/aggregation.
Previously: was just setting the new names to a standard '{geo_id} {technology}' formula; this lost some detail for units whose pre-collapse naming convention had different structures for representing technologies. Wasn't causing bugs or issues at this stage - but for mapping against constraints from plexos files or other AEMO-sourced name-keyed values, losing the names' structure had potential to be annoying AND was an easy fix. (+ keeps consistent with non-renamed units e.g. those in REZs).
Now: the actual 'old' geo_id string in a unit name gets re-keyed to the new geo_id (collapsed), keeping the rest of the name as-is. The first 'name' value for each collapsed-group is kept upon aggregation; this is the name that gets used to re-key. This implementation does assume that the naming convention for aggregated units (grouped on technology, geo_id and optionally resource_type) is the same for all units in each group, and that the 'new' geo_id is correctly assigned regardless of the old geo_id-like string prefix in each name. Based on current 7.5 workbook data this holds. Special case 'BOTN - Cethana' doesn't get aggregated with anything else so name gets passed through unchanged.
Example to illustrate the difference:
Built off #143