-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
What
Refactor the three marginal cost generator scripts into a dedicated utils/pre/marginal_costs/ package with a shared common.py module, replacing the current flat layout under utils/pre/.
Current layout:
utils/pre/generate_utility_supply_mc.py(energy LBMP + capacity ICAP)utils/pre/generate_utility_tx_dx_mc.py(distribution + sub-transmission via PoP)utils/pre/generate_bulk_tx_mc.py(bulk transmission via SCR)
Proposed layout:
utils/pre/marginal_costs/
├── __init__.py
├── common.py # shared utilities (see below)
├── supply.py # energy LBMP + capacity ICAP (from generate_utility_supply_mc.py)
├── distribution.py # distribution + sub-tx via PoP (from generate_utility_tx_dx_mc.py)
└── bulk_transmission.py # bulk Tx via SCR (from generate_bulk_tx_mc.py)
Why
The three generators share significant code that is currently handled by cross-imports:
build_cairo_8760_timestamps()— supply MC defines it, bulk Tx imports itload_utility_load_profile()+normalize_load_to_cairo_8760()— tx_dx MC defines them, supply MC and bulk Tx import themload_zone_mapping()+get_utility_mapping()— supply MC defines them, bulk Tx imports them- S3 save/output patterns are similar across all three
This creates a fragile import graph. A shared common.py would make the dependency clearer and reduce coupling.
How
- Create
utils/pre/marginal_costs/package with__init__.py. - Extract shared functions into
common.py:build_cairo_8760_timestamps,load_utility_load_profile,normalize_load_to_cairo_8760,load_zone_mapping,get_utility_mapping. - Move each generator into the package, updating imports to use
common. - Update all consumers: tests (
tests/test_marginal_cost_allocation.py,tests/test_bulk_tx_mc.py), Justfiles (rate_design/hp_rates/ny/Justfile,rate_design/hp_rates/Justfile), andrun_scenario.py. - Verify
just checkandjust testpass.
Deliverables
-
utils/pre/marginal_costs/package withcommon.pyand three generator modules - All existing tests pass with updated imports
- Justfile recipes updated to point to new module paths
- No remaining cross-imports between generator modules (all shared code in
common.py)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels