Summary
The retail-rate module crashes with KeyError: 'res_marg_ann_flow' when interpolating between solve years, so retail_rate_components.csv is never produced. This appeared on a single-region (single-BA) ND run and is likely because that run has no interregional reserve-margin flows — but it should be confirmed against a multi-region run before assuming it is single-region-specific.
Traceback (from runs/v20260707_213749_ND_small/gamslog.txt)
retail_rate_calculations.py | 21:50:12 | ERROR | File ".../retail_rate_module/retail_rate_calculations.py", line 2337, in <module>
main(
retail_rate_calculations.py | 21:50:12 | ERROR | File ".../retail_rate_calculations.py", line 534, in main
interp_between_solve_years(
retail_rate_calculations.py | 21:50:12 | ERROR | File ".../retail_rate_calculations.py", line 111, in interp_between_solve_years
df_pivot_solve_years.update(df.pivot(index='t', columns=region_type, values=value_name))
retail_rate_calculations.py | 21:50:12 | ERROR | KeyError: 'res_marg_ann_flow'
Diagnosis
In interp_between_solve_years, df.pivot(..., values='res_marg_ann_flow') fails because that column is absent from the frame. The most likely cause: the ND run is a single balancing area, so there are no interregional reserve-margin (res_marg_ann_flow) records to carry that column. A guard for the empty/absent case (skip or create an empty component) would let the module finish.
Impact — missing output
outputs/retail_rate_components.csv is not produced.
Everything upstream of retail rates is fine — the model solved all years optimally and core outputs (cap, gen, systemcost, reeds-report) are present.
Code references
postprocessing/retail_rate_module/retail_rate_calculations.py:111 — the failing df.pivot(..., values='res_marg_ann_flow')
postprocessing/retail_rate_module/retail_rate_calculations.py:534 — interp_between_solve_years(...) call in main
Suggested next step
Reproduce on a multi-region case. If it only fails single-region, guard interp_between_solve_years (or the caller) so a missing/empty res_marg_ann_flow is handled gracefully rather than raising. Upstream code (postprocessing/retail_rate_module/), so also a candidate to report upstream once the scope is confirmed.
Summary
The retail-rate module crashes with
KeyError: 'res_marg_ann_flow'when interpolating between solve years, soretail_rate_components.csvis never produced. This appeared on a single-region (single-BA) ND run and is likely because that run has no interregional reserve-margin flows — but it should be confirmed against a multi-region run before assuming it is single-region-specific.Traceback (from runs/v20260707_213749_ND_small/gamslog.txt)
Diagnosis
In
interp_between_solve_years,df.pivot(..., values='res_marg_ann_flow')fails because that column is absent from the frame. The most likely cause: the ND run is a single balancing area, so there are no interregional reserve-margin (res_marg_ann_flow) records to carry that column. A guard for the empty/absent case (skip or create an empty component) would let the module finish.Impact — missing output
outputs/retail_rate_components.csvis not produced.Everything upstream of retail rates is fine — the model solved all years optimally and core outputs (cap, gen, systemcost, reeds-report) are present.
Code references
postprocessing/retail_rate_module/retail_rate_calculations.py:111— the failingdf.pivot(..., values='res_marg_ann_flow')postprocessing/retail_rate_module/retail_rate_calculations.py:534—interp_between_solve_years(...)call inmainSuggested next step
Reproduce on a multi-region case. If it only fails single-region, guard
interp_between_solve_years(or the caller) so a missing/emptyres_marg_ann_flowis handled gracefully rather than raising. Upstream code (postprocessing/retail_rate_module/), so also a candidate to report upstream once the scope is confirmed.