Skip to content

Template locational cost factors for new entrants - #132

Merged
EllieKallmier merged 3 commits into
mainfrom
template-new-entrant-lcf
Aug 10, 2026
Merged

Template locational cost factors for new entrants#132
EllieKallmier merged 3 commits into
mainfrom
template-new-entrant-lcf

Conversation

@EllieKallmier

Copy link
Copy Markdown
Member

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)

  • the usual tests and test data added :)

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!

@EllieKallmier EllieKallmier added type: feature New feature or request module: templater Covers contents of `templater` module labels Jul 17, 2026
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/ispypsa/iasr_table_caching/local_cache.py 74.28% <ø> (ø)
src/ispypsa/templater/new_entrants.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nick-gorman nick-gorman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi Ellie,

Looking good to me. Just a couple of minor suggestions from me.

Comment thread src/ispypsa/templater/new_entrants.py Outdated
Comment thread src/ispypsa/templater/new_entrants.py Outdated
EllieKallmier and others added 2 commits August 10, 2026 16:26
Co-authored-by: nick-gorman <40549624+nick-gorman@users.noreply.github.com>
@EllieKallmier
EllieKallmier merged commit 25a2761 into main Aug 10, 2026
15 checks passed
@EllieKallmier
EllieKallmier deleted the template-new-entrant-lcf branch August 10, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: templater Covers contents of `templater` module type: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants