Template locational cost factors for new entrants - #132
Open
EllieKallmier wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
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.
This PR adds the last two property columns in the new entrants' schemas: lcf_build and lcf_om .
lcf_build (build/connection cost factor) is looked up per (geo_id, technology) directly from IASR's precomputed technology_specific_lcfs grid, rather than re-derived from the more granular cost-breakdown-ratio × locational-cost-factor tables. This is a slight simplification (noted in docstring) that doesn't lose any IASR data, but it does mean that if a user hand-edits the raw component tables before templating, those edits won't flow through; only an edit to technology_specific_lcfs itself will. Ofc edits to the templated values themselves will still apply and carry through the rest of the model. >Am open to changing this to calculate lcf_build from component tables if it feels like a worthwhile addition; however, at the moment we've been working on an assumption that the iasr_tables input to the templater come directly from the (parsed) IASR workbook itself and that we don't expect edits to those inputs, so that's where this simplification comes from.
lcf_om is unrelated to that calculation — it's a straight per-zone lookup (O&M costs 3 column of locational_cost_factors), technology-independent. Handled on its own rather than piped into the property-merging pipeline directly because the lookup is geo_id rather than technology: the technology-mapped pipeline applies fuzzy matching that would not be appropriate to apply to geo_id's (which are usually <=4 chars), which should match exactly or not at all.
src/ispypsa/
├── iasr_table_caching/local_cache.py ← registers technology_specific_lcfs + locational_cost_factors for the cache builder
├── templater/new_entrants.py ← lcf_build / lcf_om merge logic, shared _assert_table_valid primitive
└── validation/schemas/
├── generators_new_entrant.yaml ← required-tables doc: technology_cost_breakdown_ratios → technology_specific_lcfs
└── storage_new_entrant.yaml ← same swap; also drops locational_cost_pumped_hydro_factors (not actually used)
Note: generators_new_entrant/storage_new_entrant still aren't fully wired in as create_template.py outputs yet — they're only consumed internally by connection-cost templating (keeping this PR smaller-ish). That's next to come!