Move more inputs to inputs.h5 and add compatibility with forecast.py - #139
Open
patrickbrown4 wants to merge 34 commits into
Open
Move more inputs to inputs.h5 and add compatibility with forecast.py#139patrickbrown4 wants to merge 34 commits into
inputs.h5 and add compatibility with forecast.py#139patrickbrown4 wants to merge 34 commits into
Conversation
… some more inputs to inputs.h5
… table into individual parameters
…es.py when resolutions differ
…rts(); io.py: clean up gamsify_header()
patrickbrown4
commented
Jul 9, 2026
| x.csv,.csv,1,None,9999,None,9999,0,constant,None,None,new, | ||
| yearafter.csv,.csv,1,None,9999,None,9999,0,constant,None,None,new, | ||
| years_until_endogenous.csv,.csv,1,None,9999,None,9999,0,constant,None,None,done,constant | ||
| allh,inputs.h5,1,,,,9999,,,,,, |
Contributor
Author
There was a problem hiding this comment.
I'm looking forward to removing all the entries that are ignored, but let's save that for a followup (and discuss how to make sure new t-dependent parameters are handled if we aren't enforcing (mostly empty) entries for all parameters)
patrickbrown4
commented
Jul 9, 2026
| GSw_Region,cendiv/Pacific,,country/USA,country/USA,country/USA,,st/ID.WY.NE.IA.IL,st/MA,,,,,,,st/WY,interconnect/western,transreg/PJM,st/NY.VT,st/OR,st/NE.NY.PA,st/NE.NY.PA,st/ID.WY.NE.IA.IL,st/KS,country/USA,country/USA,,,,st/MA.RI.CT.NY.NJ.PA.OH, | ||
| endyear,2032,,2050,2050,2050,2029,2060,2026,,,,,,,,,,,2035,2030,2030,2060,2035,2050,2050,,,,, | ||
| yearset,,,,,,,2010..2060..10,,,,,,,,,,,,,2010..2050..5,2010..2050..5,2010..2060..10,,,2010_2025_2050,,,,, | ||
| yearset,,,,,,,2010..2060..10,,,,,,,,,,,,,2010..2050..5,2010..2050..5,2010..2060..10,,2010..2050..5,2010_2025_2050,,,,, |
Contributor
Author
There was a problem hiding this comment.
USA_fast originally used 5-year steps; I'm not sure when that was dropped but this just changes it back
patrickbrown4
commented
Jul 9, 2026
| + '\n> '.join([c for c in df_cases.columns]) | ||
| ) | ||
| raise KeyError(err) | ||
| raise ValueError(err) |
Contributor
Author
There was a problem hiding this comment.
Prints a prettier message this way
patrickbrown4
commented
Jul 9, 2026
| sw['financials_sys_suffix'], inflation_df, modeled_years, | ||
| years, year_map, sw['sys_eval_years'], scen_settings, scalars['co2_capture_incentive_length'],scalars['h2_ptc_length']) | ||
| financials_sys.to_csv(os.path.join(inputs_case,'financials_sys.csv'),index=False) | ||
| financials_sys.to_csv(os.path.join(inputs_case,'financials_sys_full.csv'),index=False) |
Contributor
Author
There was a problem hiding this comment.
Avoids errors when restarting this script (since before it was overwriting a file in inputs_case)
This was referenced Jul 12, 2026
23 tasks
15 tasks
kodiobika
reviewed
Jul 23, 2026
Co-authored-by: kodiobika <35176195+kodiobika@users.noreply.github.com>
Co-authored-by: kodiobika <35176195+kodiobika@users.noreply.github.com>
patrickbrown4
added a commit
that referenced
this pull request
Jul 27, 2026
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.
Summary
This PR builds on #61 by moving more inputs to
inputs.h5, removing another ~10% (~600 lines) ofb_inputs.gms.Technical details
Implementation notes
Most of the changes are just normalizing headers in input .csv files and changing
.to_csv()toreeds.io.write_input_to_h5(). Outputs of the following input-processing scripts are moved toinputs.h5:calc_financial_inputs.py: completetransmission.py: completecopy_files.py: a smattering (not complete)More substantive changes are:
forecast.pyis adapted to work for parameters ininputs.h5forecast.pyis also moved later in the input-processing pipeline; in its old location it was missing some parameters fromtransmission.py. The new parameters are added to the bottom offuturefiles.csv.b_inputs.gmstoget_co2_site_char()intransmission.pytindex is removed fromcost_co2_stor_becbecause it doesn't vary with timeGSw_TransCostMultis moved upstream totransmission.pyinputs/waterclimatefiles are reshaped from wide to longoverwriteinreeds.io.write_input_to_h5()is turned on by default, making the input-processing scripts easier to debugAdditional changes
reedsplots.plot_diff_maps(): Alevelparameter is added, and when used incompare_cases.py, state resolution is used when runs with different spatial resolution are compared (thanks @kodiobika for the idea and initial implementation)plots.rainbowmapper(): colormap moved to keyword argumentValidation, testing, and comparison report(s)
Only rounding differences for the Pacific test case (expected when moving from .csv to .h5):
results-v20260708_mainM0_Pacific,v20260708_inputsM2_Pacific.pptx
Same for USA_defaults: results-v20260708_mainK0_USA_defaults,v20260708_inputsK1_USA_defaults.pptx
Checklist for author
trancap_init_energyto .csv or set up r2x to read frominputs.h5)Details to double-check
General information to guide review
Did you use LLM tools (chatbot or copilot) in the preparation of this PR? If so, describe how
No