Skip to content

Commit

Permalink
Merge pull request #126 from koen-vg/keep-index-names
Browse files Browse the repository at this point in the history
Make sure to keep "technology" and "parameter" multiindex names
  • Loading branch information
fneum committed Mar 19, 2024
2 parents 09e85a6 + 3a418ee commit 6e5066b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/compile_cost_assumptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,7 @@ def add_egs_data(data):
"""
parameters = ["CO2 intensity", "lifetime", "efficiency residential heat", "efficiency electricity", "FOM"]
techs = ["geothermal"]
multi_i = pd.MultiIndex.from_product([techs, parameters])
multi_i = pd.MultiIndex.from_product([techs, parameters], names=["technology", "parameter"])
geoth_df = pd.DataFrame(index=multi_i, columns=data.columns)
years = [col for col in data.columns if isinstance(col, int)]

Expand Down Expand Up @@ -1855,7 +1855,7 @@ def add_SMR_data(data):
"""
parameters = ["FOM", "investment", "lifetime", "efficiency"]
techs = ["SMR", "SMR CC"]
multi_i = pd.MultiIndex.from_product([techs, parameters])
multi_i = pd.MultiIndex.from_product([techs, parameters], names=["technology", "parameter"])
SMR_df = pd.DataFrame(index=multi_i, columns=data.columns)

# efficiencies per unit in LHV (stays constant 2019 to 2050)
Expand Down Expand Up @@ -1912,6 +1912,7 @@ def add_mean_solar_rooftop(data):
rooftop["source"] = "Calculated. See 'further description'."
rooftop["further description"] = "Mixed investment costs based on average of 50% 'solar-rooftop commercial' and 50% 'solar-rooftop residential'"
# add to data
rooftop.index.names = data.index.names
data = pd.concat([data, rooftop])
# add solar assuming 50% utility and 50% rooftop
solar = (data.loc[["solar-rooftop", "solar-utility"]][years]).astype(float).groupby(level=1).mean()
Expand All @@ -1921,6 +1922,7 @@ def add_mean_solar_rooftop(data):
solar["further description"] = "Mixed investment costs based on average of 50% 'solar-rooftop' and 50% 'solar-utility'"
# set multi index
solar = pd.concat([solar], keys=["solar"])
solar.index.names = data.index.names
return pd.concat([data, solar])


Expand Down

0 comments on commit 6e5066b

Please sign in to comment.