Template new entrant property merges - #128
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
|
Made a change! I don't think this PR had been reviewed yet so to avoid making you review then basically re-review the same stuff I've just bundled an update to how I've handled BOTN - Cethana in here - hope that's not too much stuff in one block. The main thing to note is just that for now I have jsut set BOTN's 'technology' to 'BOTN - Cethana'; most of the property tables key BOTN's values using that exact string (except for, annoyingly, There are some more notes and other thoughts from me in: #127. I don't think this is fully resolved/settled just yet so I'm going to keep that issue open, but will note that this is the approach I'll take for now (open to alternatives or preferences in a different direction ofc). |
nick-gorman
left a comment
There was a problem hiding this comment.
Looks great Ellie. Very readable and nicely structured. I also agree with the testing mainly at the helper level here, as otherwise it would get quiet verbose.
See below comment for updates - re: BOTN handling
This PR adds merging in of 'property' values for new entrant storage and generation tables. These are the numeric values that map to 'technology' (see the *_PROPERTY_MAP dicts in mappings for full coverage of what's getting merged in here). Still not outputting the *_new_entrant tables from templater so not 100% wired in yet - coming in next PR(s) :)
Storage gets split up into pumped hydro and battery chunks to merge in properties whose values are in different tables, then recombines to return a unified 'storage' table still. There's a bit of special handling around BOTN - Cethana, which is the only 'named' new entrant unit and has some bespoke mappings (using 'name' rather than 'technology' to key). Happy to take suggestions on this handling and have opened up #127 issue to explore this in a bit more depth.
Where things live
src/ispypsa/templater/
├── new_entrants.py ← the two orchestrators + the merge machinery + BOTN handling
├── mappings.py ← the property maps (common, battery, PHES)
├── create_template.py ← storage templater now takes the full iasr_tables dict
└── helpers.py ← incidental: _fuzzy_map_to_canonical renamed (see below)
src/ispypsa/iasr_table_caching/local_cache.py ← register battery_properties + pumped_hydro
tests/test_workbook_table_cache/7.5/*.csv ← frozen cache gains the property tables
There's also an incidental rename of
_fuzzy_map_to_canonical->_fuzzy_map_to_allowed_valuesbecause it became more useful to kind of flexibly specify which set of strings to use as the 'choices' than explicitly say one is canon.LCF values to be merged in next :)