Allow country-specific district heating potentials#1742
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR extends the district_heating: potential configuration to accept either a float or a country-specific dictionary with an optional default fallback.
- Adds logic to detect and apply dictionary-based potentials, filling missing countries with a required
defaultvalue. - Maps the resulting per-country potentials onto each node’s population layout.
- Updates documentation tables and release notes to describe the new config option.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| scripts/build_district_heat_share.py | Add branch to handle dict-typed potential, enforce default, and map per-country values |
| doc/release_notes.rst | Note support for dictionary-based district heating potentials |
| doc/configtables/sector.csv | Update the potential config table entry to mention dict support |
Comments suppressed due to low confidence (3)
scripts/build_district_heat_share.py:69
- Consider adding unit tests covering the new dictionary-based branch, including cases for full country mappings, missing
defaultraising a ValueError, and correct fallback behavior to ensure this logic is exercised.
if isinstance(central_fraction, dict):
doc/release_notes.rst:14
- [nitpick] The release note could also mention that supplying a partial mapping requires a
defaultkey for unspecified countries and describe the fallback behavior to make it fully clear to users.
* Allow district heating potentials to be optionally specified as a dictionary as an alternative to a float, with country codes as keys of the parameter `district_heating: potential`.
doc/configtables/sector.csv:11
- [nitpick] The indentation for the
potentialentry was changed from three hyphens to two; please align it with the existing hierarchical dash conventions in this CSV to maintain consistency and parsing correctness.
-- potential,--,Dictionary with country codes as keys or float.,"Maximum fraction of urban demand which can be supplied by district heating. If given as dictionary, specify one value per country modeled or provide a default value with key `default` to fill values for all unspecified countries."
amos-schledorn
requested changes
Jul 10, 2025
Contributor
amos-schledorn
left a comment
There was a problem hiding this comment.
Looks great! I'd just suggest adding some comments to explain the logic
amos-schledorn
approved these changes
Jul 10, 2025
toniseibold
pushed a commit
that referenced
this pull request
Dec 1, 2025
* allow country-specific district heating potentials * fix: handle missing district heating potential for countries * docs: add comments to enhance comprehensibility --------- Co-authored-by: cpschau <[email protected]> Co-authored-by: Fabian Neumann <[email protected]>
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.
Changes proposed in this Pull Request
This PR extends the
sector:district_heating:potentialconfig parameter to accept either a single float (as before) or a dictionary with country-specific district heating potentials.Default behavior: If no dictionary is provided, the parameter remains a float (default:
0.6).Country-specific potentials: Users can supply a dictionary mapping country codes to potential values:
For partial coverage, the dictionary must include:
'default'key for all other countries as a fallback valueFor full coverage, the dictionary must contain a value for each country code in the model.
Testing
Using config.default.yaml the following scenarios:
Checklist
config/config.default.yaml.doc/configtables/*.csv.doc/release_notes.rstis added.