Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
640e164
Replace instances of CAP with CAP_CLASS in outputs.
wesleyjcole Sep 3, 2026
92e9cc4
Add class to INV_REFURB and m_cf_filt.
wesleyjcole Sep 3, 2026
5c1a5e5
Propagate "c" through 6_data_dump.gms
wesleyjcole Sep 3, 2026
a7c08a5
Add class to resources input.
wesleyjcole Sep 3, 2026
250e101
Add class to relevant resource_adequacy parameters.
wesleyjcole Sep 3, 2026
b97a64c
Add class to reeds_to_rev.py inputs.
wesleyjcole Sep 3, 2026
8f3f31e
Add class to more outputs
wesleyjcole Sep 3, 2026
65735b2
Add class to cap_ivrt.
wesleyjcole Sep 3, 2026
d19892f
Add class to Bokeh.
wesleyjcole Sep 3, 2026
a31ff0d
Add class to cap_out.
wesleyjcole Sep 3, 2026
701deec
Remove class splitting from reeds_to_rev.py
wesleyjcole Sep 3, 2026
d0cdb47
Add class to cap_new_ivrt_refurb.
wesleyjcole Sep 3, 2026
89f7e25
Add class to LCOE outputs.
wesleyjcole Sep 3, 2026
485daef
(forgot to include this file with the last commit...).
wesleyjcole Sep 3, 2026
2f948ab
Add class to additional capacity by ivrt outputs
wesleyjcole Sep 3, 2026
1bfc477
Add class to cap_avail and capex_ivrt
wesleyjcole Sep 3, 2026
005e479
Fix issue in Bokeh
wesleyjcole Sep 3, 2026
098e2a4
Adjust csp-ns allocation
wesleyjcole Sep 4, 2026
f5b2076
Merge branch 'wjc/dev/separate_class' into wjc/outputs_class
wesleyjcole Sep 8, 2026
e5eff11
Update bokeh class assignments.
wesleyjcole Sep 9, 2026
ea86ae1
Add "excess" and and unallocated csp-ns to compare_cases.py
wesleyjcole Sep 9, 2026
550fbb0
Move csp-ns reassignment parameters to report_params.csv
wesleyjcole Sep 9, 2026
56e65c2
Fix csp-ns accounting error.
wesleyjcole Sep 9, 2026
a17e8bb
Update comment for cap_cspns
wesleyjcole Sep 9, 2026
3036306
Add class to merges in bokeh.
wesleyjcole Sep 9, 2026
caa4fff
Select numeric value columns in uncertainty_plots.py
wesleyjcole Sep 9, 2026
9860c76
Reorder indices of cap_cspns to be consistent. Also adjust reporting…
wesleyjcole Sep 9, 2026
d1d3c79
Add groupby rather than drop class column
wesleyjcole Sep 9, 2026
7ff1628
Change description to unassigned.
wesleyjcole Sep 11, 2026
e92fd37
Fixes for reeds_to_rev.py
wesleyjcole Sep 11, 2026
8a60ebf
Add additional groupby for uncertainty_plots.py
wesleyjcole Sep 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 12 additions & 23 deletions hourlize/reeds_to_rev.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

(Not related to this PR) I am also getting a suggested edit on line 1610: 'rcby' seems to be defined in line 1647... I wonder if it needs to be renamed to 'rcy' defined earlier, or move some code around?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

reeds_to_rev.py isn't working right now, but this is a quick fix, so I can add it in here.

Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def get_preexisting_capacity(df_sc_in, tech, first_model_year=2009):
# Find existing capacity by bin with raw supply curve.
# Consider existing capacity as investment in 2009 to use the
# same logic as inv_rsc when assigning to gid.
exist_columns = ["tech", "region", "year", "bin", "MW"]
exist_columns = ["tech", "class", "region", "year", "bin", "MW"]
if "existing_capacity" in df_sc_in:
if "online_year" not in df_sc_in:
raise KeyError(
Expand Down Expand Up @@ -333,11 +333,9 @@ class that can be used to check capacity values at the end of disaggregation.
# Get check for capacity
cap_chk = os.path.join(run_folder, "outputs", "cap.csv")
df_cap_chk = pd.read_csv(
cap_chk, low_memory=False, names=["tech", "region", "year", "MW"], header=0
)
df_cap_chk[["tech_cat", "class"]] = df_cap_chk["tech"].str.rsplit(
"_", n=1, expand=True
cap_chk, low_memory=False, names=["tech", "class", "region", "year", "MW"], header=0
)
df_cap_chk["tech_cat"] = df_cap_chk["tech"].str.rsplit("_", n=1).str[0]
df_cap_chk = df_cap_chk[df_cap_chk["tech_cat"] == tech].copy()
df_cap_chk = df_cap_chk[["year", "region", "class", "MW"]].dropna(subset=["class"])
df_cap_chk["class"] = df_cap_chk["class"].astype("int")
Expand Down Expand Up @@ -370,8 +368,8 @@ def get_new_investments(run_folder, tech):
df_inv_rsc = pd.read_csv(
inv_rsc,
low_memory=False,
names=["tech", "vintage", "region", "year", "bin", "MW"],
usecols=["tech", "region", "year", "bin", "MW"],
names=["tech", "class", "vintage", "region", "year", "bin", "MW"],
usecols=["tech", "class", "region", "year", "bin", "MW"],
header=0,
)
df_inv_rsc = df_inv_rsc[df_inv_rsc["tech"].str.startswith(tech)].copy()
Expand Down Expand Up @@ -401,8 +399,6 @@ def combine_preexisting_and_new_investments(df_bin_exist, df_inv_rsc):
"""
# Concatenate existing and inv_rsc
df_inv = pd.concat([df_bin_exist, df_inv_rsc], sort=False, ignore_index=True)
# Split tech from class
df_inv[["tech_cat", "class"]] = df_inv["tech"].str.rsplit("_", n=1, expand=True)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

got it, because 'class' is already part of the data upstream, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's right.

df_inv = df_inv[["year", "region", "class", "bin", "MW"]]
df_inv["class"] = df_inv["class"].astype("int")
df_inv["bin"] = df_inv["bin"].str.replace("bin", "", regex=False).astype("int")
Expand Down Expand Up @@ -435,9 +431,9 @@ def get_input_refurbishments(run_folder, tech):
df_inv_refurb_in = pd.read_csv(
inv_refurb,
low_memory=False,
names=["tech", "vintage", "region", "year", "MW"],
names=["tech", "class", "vintage", "region", "year", "MW"],
header=0,
usecols=["tech", "region", "year", "MW"],
usecols=["tech", "class", "region", "year", "MW"],
)
df_inv_refurb_in = df_inv_refurb_in[
df_inv_refurb_in["tech"].str.startswith(tech)
Expand All @@ -462,14 +458,7 @@ def amend_refurbishments(df_inv_refurb_in):
Returns refurbishments for the given technology, by year, region, and class.
Output columns include: ["year", "region", "class", "MW"]
"""
# Split tech from class
df_inv_refurb = df_inv_refurb_in.copy()
if df_inv_refurb.empty:
df_inv_refurb[["tech_cat", "class"]] = ""
else:
df_inv_refurb[["tech_cat", "class"]] = df_inv_refurb["tech"].str.split(
"_", n=1, expand=True
)
df_inv_refurb = df_inv_refurb[["year", "region", "class", "MW"]]
df_inv_refurb["class"] = df_inv_refurb["class"].astype("int")
df_inv_refurb = df_inv_refurb.sort_values(by=["year", "region", "class"])
Expand Down Expand Up @@ -593,9 +582,9 @@ def get_exogenous_capacity(run_folder, tech):
df_cap_exog = pd.read_csv(
cap_exog,
low_memory=False,
names=["tech", "vintage", "region", "year", "MW"],
names=["tech", "class", "vintage", "region", "year", "MW"],
header=0,
usecols=["tech", "region", "year", "MW"],
usecols=["tech", "class", "region", "year", "MW"],
)
df_cap_exog = df_cap_exog[df_cap_exog["tech"].str.startswith(tech)].copy()

Expand Down Expand Up @@ -1540,7 +1529,7 @@ def simultaneous_fill(
break
# check to make sure inv_left isn't negative
if ret_left < 0:
print(f"ERROR at rcby={rcby}: ret_left is negative: {ret_left}")
print(f"ERROR at rcy={rcy}: ret_left is negative: {ret_left}")

if np.floor(ret_left * 100) / 100 != 0:
print(
Expand Down Expand Up @@ -1607,7 +1596,7 @@ def simultaneous_fill(
# check to make sure inv_left isn't negative
if refurb_left < 0:
print(
f"ERROR at rcby={rcby}: refurb_left is negative: {refurb_left}"
f"ERROR at rcy={rcy}: refurb_left is negative: {refurb_left}"
)

if round(refurb_left, 2) != 0:
Expand Down Expand Up @@ -2016,7 +2005,7 @@ def check_tech(run_folder, tech):
"""
cap_chk = os.path.join(run_folder, "outputs", "cap.csv")
df_cap = pd.read_csv(
cap_chk, low_memory=False, names=["tech", "region", "year", "MW"], header=0
cap_chk, low_memory=False, names=["tech", "class", "region", "year", "MW"], header=0
)
tech_included = df_cap["tech"].str.startswith(tech).any()

Expand Down
63 changes: 32 additions & 31 deletions postprocessing/bokehpivot/reeds2.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks great programmatically. Conceptually, it might make sense to include the class in cap_energy_ivrt and/or cap_firm and cap_firm_iter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think it's necessary in cap_energy_ivrt because there are no class-relevant technologies for energy in the initial scope. It would make sense if PSH gets a class at some point.

cap_firm, though, should get a class designation. We'll want to know exactly the capacity contribution of a technology. That will require making m_cc_mar adopt a class, which also needs to happen at some point. I've been focusing on stress periods, but I'll note this for follow-on work once I have a working stress-period formulation with collapsed classes. The output rename would also go along with that.

Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,10 @@ def pre_abatement_cost(dfs, **kw):
return df

def add_class(df, **kw):
cond = df['tech'].str.contains('_', regex=False)
#Assume class is at the end, after the final underscore:
df.loc[cond, 'class']='class_' + df.loc[cond, 'tech'].str.split('_').str[-1]
#Class is read from the class column; '0' marks techs with no resource class
cond = df['class'].astype(str) != '0'
df.loc[cond, 'class'] = 'class_' + df.loc[cond, 'class'].astype(str)
df.loc[~cond, 'class'] = None
return df

def sort_timeslices(df, **kw):
Expand Down Expand Up @@ -817,12 +818,12 @@ def pre_lcoe(dfs, **kw):
#Apply inflation
dfs['lcoe']['$/MWh'] = inflate_series(dfs['lcoe']['$/MWh'])
#Merge with available capacity
df = pd.merge(left=dfs['lcoe'], right=dfs['avail'], how='left', on=['tech', 'rb', 'year', 'bin'], sort=False)
df = pd.merge(left=dfs['lcoe'], right=dfs['avail'], how='left', on=['tech', 'class', 'rb', 'year', 'bin'], sort=False)
df['available MW'] = df['available MW'].fillna(0)
df['available'] = 'no'
df.loc[df['available MW'] > 0.001, 'available'] = 'yes'
#Merge with chosen capacity
df = pd.merge(left=df, right=dfs['inv'], how='left', on=['tech', 'vintage', 'rb', 'year', 'bin'], sort=False)
df = pd.merge(left=df, right=dfs['inv'], how='left', on=['tech', 'class', 'vintage', 'rb', 'year', 'bin'], sort=False)
df['chosen MW'] = df['chosen MW'].fillna(0)
df['chosen'] = 'no'
df.loc[df['chosen MW'] != 0, 'chosen'] = 'yes'
Expand Down Expand Up @@ -1375,7 +1376,7 @@ def pre_spur(dfs, **kw):

('Capacity BA (GW)',
{'file':'cap',
'columns': ['tech', 'rb', 'year', 'Capacity (GW)'],
'columns': ['tech', 'class', 'rb', 'year', 'Capacity (GW)'],
'preprocess': [
{'func': scale_column, 'args': {'scale_factor': .001, 'column':'Capacity (GW)'}},
],
Expand All @@ -1395,7 +1396,7 @@ def pre_spur(dfs, **kw):

('Capacity BA by class (GW)',
{'file':'cap',
'columns': ['tech', 'rb', 'year', 'Capacity (GW)'],
'columns': ['tech', 'class', 'rb', 'year', 'Capacity (GW)'],
'preprocess': [
{'func': add_class, 'args': {}},
{'func': scale_column, 'args': {'scale_factor': .001, 'column':'Capacity (GW)'}},
Expand All @@ -1407,7 +1408,7 @@ def pre_spur(dfs, **kw):

('Capacity ivrt (GW)',
{'file':'cap_ivrt',
'columns': ['tech', 'vintage', 'rb', 'year','Capacity (GW)'],
'columns': ['tech', 'class', 'vintage', 'rb', 'year','Capacity (GW)'],
'preprocess': [
{'func': scale_column, 'args': {'scale_factor': .001, 'column':'Capacity (GW)'}},
],
Expand Down Expand Up @@ -1456,7 +1457,7 @@ def pre_spur(dfs, **kw):
('Storage Capacity (GW or GWh)',

{'sources': [
{'name': 'cap', 'file': 'cap', 'columns': ['tech', 'rb', 'year', 'Capacity (GW)']},
{'name': 'cap', 'file': 'cap', 'columns': ['tech', 'class', 'rb', 'year', 'Capacity (GW)']},
{'name': 'energy', 'file': 'stor_energy_cap', 'columns': ['tech', 'vintage', 'rb', 'year', 'Energy (GWh)']},
{'name': 'bcr', 'file': '../inputs_case/bcr.csv', 'columns': ['tech', 'bcr']},
],
Expand Down Expand Up @@ -1540,7 +1541,7 @@ def pre_spur(dfs, **kw):

('Exogenous capacity (GW)',
{'file':'cap_exog',
'columns': ['tech', 'vintage', 'region', 'year', 'Capacity (GW)'],
'columns': ['tech', 'class', 'vintage', 'region', 'year', 'Capacity (GW)'],
'preprocess': [
{'func': scale_column, 'args': {'scale_factor': .001, 'column':'Capacity (GW)'}},
],
Expand Down Expand Up @@ -1893,7 +1894,7 @@ def pre_spur(dfs, **kw):
('Capacity Factor ivrt',
{'sources': [
{'name': 'gen', 'file': 'gen_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year','MWh']},
{'name': 'cap', 'file': 'cap_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year','MW']},
{'name': 'cap', 'file': 'cap_ivrt', 'columns': ['tech', 'class', 'vintage', 'rb', 'year','MW']},
],
'preprocess': [
{'func': pre_cf, 'args': {}},
Expand Down Expand Up @@ -1979,7 +1980,7 @@ def pre_spur(dfs, **kw):
('Firm Capacity National (GW)',
{'sources': [
{'name': 'firmcap', 'file': 'cap_firm', 'columns': ['tech', 'rb', 'season', 'year', 'Firm Capacity (GW)']},
{'name': 'cap', 'file': 'cap', 'columns': ['tech', 'rb', 'year', 'Capacity (GW)']},
{'name': 'cap', 'file': 'cap', 'columns': ['tech', 'class', 'rb', 'year', 'Capacity (GW)']},
],
'index': ['tech', 'season', 'year'],
'preprocess': [
Expand All @@ -1997,7 +1998,7 @@ def pre_spur(dfs, **kw):
('Firm Capacity BA (GW)',
{'sources': [
{'name': 'firmcap', 'file': 'cap_firm', 'columns': ['tech', 'rb', 'season', 'year', 'Firm Capacity (GW)']},
{'name': 'cap', 'file': 'cap', 'columns': ['tech', 'rb', 'year', 'Capacity (GW)']},
{'name': 'cap', 'file': 'cap', 'columns': ['tech', 'class', 'rb', 'year', 'Capacity (GW)']},
],
'index': ['tech', 'rb', 'season', 'year'],
'preprocess': [
Expand Down Expand Up @@ -2464,7 +2465,7 @@ def pre_spur(dfs, **kw):
('Value Streams Sequential New Techs',
{'sources': [
{'name': 'vs', 'file': 'valuestreams_chosen.csv', 'columns': ['tech', 'vintage', 'rb', 'year', 'var_name', 'con_name', '$']},
{'name': 'cap', 'file': 'cap_new_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year', 'MW']},
{'name': 'cap', 'file': 'cap_new_ivrt', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'MW']},
{'name': 'gen', 'file': 'gen_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year', 'MWh']},
{'name': 'pvf_cap', 'file': 'pvf_capital', 'columns': ['year', 'pvfcap']},
{'name': 'pvf_onm', 'file': 'pvf_onm', 'columns': ['year', 'pvfonm']},
Expand Down Expand Up @@ -2494,7 +2495,7 @@ def pre_spur(dfs, **kw):
('Competitiveness Sequential New Techs',
{'sources': [
{'name': 'vs', 'file': 'valuestreams_chosen.csv', 'columns': ['tech', 'vintage', 'rb', 'year', 'var_name', 'con_name', '$']},
{'name': 'cap', 'file': 'cap_new_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year', 'MW']},
{'name': 'cap', 'file': 'cap_new_ivrt', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'MW']},
{'name': 'gen', 'file': 'gen_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year', 'MWh']},
{'name': 'pvf_cap', 'file': 'pvf_capital', 'columns': ['year', 'pvfcap']},
{'name': 'pvf_onm', 'file': 'pvf_onm', 'columns': ['year', 'pvfonm']},
Expand Down Expand Up @@ -2530,7 +2531,7 @@ def pre_spur(dfs, **kw):
('LCOE ($/MWh) Sequential New Techs (uncurt MWh)',
{'sources': [
{'name': 'vs', 'file': 'valuestreams_chosen.csv', 'columns': ['tech', 'vintage', 'rb', 'year', 'var_name', 'con_name', '$']},
{'name': 'cap', 'file': 'cap_new_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year', 'MW']},
{'name': 'cap', 'file': 'cap_new_ivrt', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'MW']},
{'name': 'gen', 'file': 'gen_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year', 'MWh']},
{'name': 'gen_uncurt', 'file': 'gen_ivrt_uncurt', 'columns': ['tech', 'vintage', 'rb', 'year', 'MWh']},
{'name': 'pvf_cap', 'file': 'pvf_capital', 'columns': ['year', 'pvfcap']},
Expand All @@ -2550,7 +2551,7 @@ def pre_spur(dfs, **kw):
('Value Streams Sequential Existing Techs',
{'sources': [
{'name': 'vs', 'file': 'valuestreams_chosen.csv', 'columns': ['tech', 'vintage', 'rb', 'year', 'var_name', 'con_name', '$']},
{'name': 'cap', 'file': 'cap_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year', 'MW']},
{'name': 'cap', 'file': 'cap_ivrt', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'MW']},
{'name': 'gen', 'file': 'gen_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year', 'MWh']},
{'name': 'pvf_cap', 'file': 'pvf_capital', 'columns': ['year', 'pvfcap']},
{'name': 'pvf_onm', 'file': 'pvf_onm', 'columns': ['year', 'pvfonm']},
Expand All @@ -2573,7 +2574,7 @@ def pre_spur(dfs, **kw):
('Value Streams Intertemporal',
{'sources': [
{'name': 'vs', 'file': 'valuestreams_chosen.csv', 'columns': ['tech', 'vintage', 'rb', 'year', 'var_name', 'con_name', '$']},
{'name': 'cap', 'file': 'cap_new_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year', 'MW']},
{'name': 'cap', 'file': 'cap_new_ivrt', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'MW']},
{'name': 'gen', 'file': 'gen_ivrt', 'columns': ['tech', 'vintage', 'rb', 'year', 'MWh']},
{'name': 'pvf_cap', 'file': 'pvf_capital', 'columns': ['year', 'pvfcap']},
{'name': 'pvf_onm', 'file': 'pvf_onm', 'columns': ['year', 'pvfonm']},
Expand Down Expand Up @@ -2679,9 +2680,9 @@ def pre_spur(dfs, **kw):

('LCOE ($/MWh)',
{'sources': [
{'name': 'lcoe', 'file': 'lcoe', 'columns': ['tech', 'vintage', 'rb', 'year', 'bin','$/MWh']},
{'name': 'inv', 'file': 'cap_new_bin_out', 'columns': ['tech', 'vintage', 'rb', 'year', 'bin','chosen MW']},
{'name': 'avail', 'file': 'cap_avail', 'columns': ['tech', 'rb', 'year', 'bin','available MW']},
{'name': 'lcoe', 'file': 'lcoe', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'bin','$/MWh']},
{'name': 'inv', 'file': 'cap_new_bin_out', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'bin','chosen MW']},
{'name': 'avail', 'file': 'cap_avail', 'columns': ['tech', 'class', 'rb', 'year', 'bin','available MW']},
],
'preprocess': [
{'func': pre_lcoe, 'args': {}},
Expand All @@ -2697,9 +2698,9 @@ def pre_spur(dfs, **kw):

('LCOE cf_act ($/MWh)',
{'sources': [
{'name': 'lcoe', 'file': 'lcoe_cf_act', 'columns': ['tech', 'vintage', 'rb', 'year', 'bin','$/MWh']},
{'name': 'inv', 'file': 'cap_new_bin_out', 'columns': ['tech', 'vintage', 'rb', 'year', 'bin','chosen MW']},
{'name': 'avail', 'file': 'cap_avail', 'columns': ['tech', 'rb', 'year', 'bin','available MW']},
{'name': 'lcoe', 'file': 'lcoe_cf_act', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'bin','$/MWh']},
{'name': 'inv', 'file': 'cap_new_bin_out', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'bin','chosen MW']},
{'name': 'avail', 'file': 'cap_avail', 'columns': ['tech', 'class', 'rb', 'year', 'bin','available MW']},
],
'preprocess': [
{'func': pre_lcoe, 'args': {}},
Expand All @@ -2715,9 +2716,9 @@ def pre_spur(dfs, **kw):

('LCOE nopol ($/MWh)',
{'sources': [
{'name': 'lcoe', 'file': 'lcoe_nopol', 'columns': ['tech', 'vintage', 'rb', 'year', 'bin','$/MWh']},
{'name': 'inv', 'file': 'cap_new_bin_out', 'columns': ['tech', 'vintage', 'rb', 'year', 'bin','chosen MW']},
{'name': 'avail', 'file': 'cap_avail', 'columns': ['tech', 'rb', 'year', 'bin','available MW']},
{'name': 'lcoe', 'file': 'lcoe_nopol', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'bin','$/MWh']},
{'name': 'inv', 'file': 'cap_new_bin_out', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'bin','chosen MW']},
{'name': 'avail', 'file': 'cap_avail', 'columns': ['tech', 'class', 'rb', 'year', 'bin','available MW']},
],
'preprocess': [
{'func': pre_lcoe, 'args': {}},
Expand All @@ -2733,9 +2734,9 @@ def pre_spur(dfs, **kw):

('LCOE fullpol ($/MWh)',
{'sources': [
{'name': 'lcoe', 'file': 'lcoe_fullpol', 'columns': ['tech', 'vintage', 'rb', 'year', 'bin','$/MWh']},
{'name': 'inv', 'file': 'cap_new_bin_out', 'columns': ['tech', 'vintage', 'rb', 'year', 'bin','chosen MW']},
{'name': 'avail', 'file': 'cap_avail', 'columns': ['tech', 'rb', 'year', 'bin','available MW']},
{'name': 'lcoe', 'file': 'lcoe_fullpol', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'bin','$/MWh']},
{'name': 'inv', 'file': 'cap_new_bin_out', 'columns': ['tech', 'class', 'vintage', 'rb', 'year', 'bin','chosen MW']},
{'name': 'avail', 'file': 'cap_avail', 'columns': ['tech', 'class', 'rb', 'year', 'bin','available MW']},
],
'preprocess': [
{'func': pre_lcoe, 'args': {}},
Expand Down Expand Up @@ -2837,7 +2838,7 @@ def pre_spur(dfs, **kw):
{'name':'tran_mi_out', 'file':'tran_mi_out', 'columns':['trtype', 'year', 'Amount (GW-mi)']},
{'name':'tran_prm_mi_out', 'file':'tran_prm_mi_out', 'columns':['trtype', 'year', 'Trans cap, PRM (GW-mi)']},
{'name':'spur_parameters', 'file':'../inputs_case/spur_parameters.csv'},
{'name':'cap_new_bin_out', 'file':'cap_new_bin_out', 'columns':['i','v','r','year','rscbin','MW']},
{'name':'cap_new_bin_out', 'file':'cap_new_bin_out', 'columns':['i','c','v','r','year','rscbin','MW']},
{'name': 'scalars', 'file': '../inputs_case/scalars.csv', 'header':None, 'columns': ['scalar', 'value', 'comment']},
],
'preprocess': [
Expand Down
2 changes: 2 additions & 0 deletions postprocessing/compare_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,9 @@ def plot_bars_abs_stacked(
'RPS': {'title': 'Non-RecMap\nRECS\n[GWh]', 'scale':1e-3},
'OpRes': {'title': 'Non-valgen\nopres\n[MWh]', 'scale':1},
'm_rsc_dat': {'title': 'Supply curve\ntweaks [GW]', 'scale':1e-3},
'cspns': {'title': 'Unassigned\ncsp-ns [MW]', 'scale':1},
'dropped': {'title': 'Dropped load\n[GWh]', 'scale':1e-3},
'excess': {'title': 'Excess load\n[GWh]', 'scale':1e-3},
}
data = {k:v for k,v in data.items() if k in dfplot.index}

Expand Down
7 changes: 6 additions & 1 deletion postprocessing/uncertainty_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,10 @@ def _fetch_cap_out(self, case: str) -> pd.DataFrame:
columns={'Value': 'Capacity (GW)', 't': 'year', 'i': 'tech'},
inplace=True,
)

# Sum over resource class
df = df.groupby(['tech', 'r', 'year'], as_index=False)['Capacity (GW)'].sum()

return df


Expand Down Expand Up @@ -973,7 +977,8 @@ def apply_transformations(
items_map = Conventions.items_color_map[items_map_name][0]
if items_column == 'tech':
df['tech'] = df['tech'].str.lower().map(lambda x: items_map.get(x, x))
df = df.groupby(['tech', 'r', 'year']).sum().reset_index()
valcols = df.select_dtypes('number').columns.difference(['year'])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

a little less familiar with this part of ReEDS, so commenting just as a point to double-check... post-processing passed the checks, so we should be good

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I took another look and decided that summing over the resource would also help here. Reviewing these and reproducing outputs for ancillary scripts like this will be a key part of testing after the i set is collapsed.

df = df.groupby(['tech', 'r', 'year'])[valcols].sum().reset_index()

# Fill missing techs with 0
idx = pd.MultiIndex.from_product(
Expand Down
Loading