Skip to content

Commit 6317eee

Browse files
committed
some more fixes still not running
1 parent ebbe3c2 commit 6317eee

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

scripts/compile_cost_assumptions.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ def get_data_DEA(tech, data_in, expectation=None):
453453
df_final["unit"] = (df_final.rename(index=lambda x:
454454
x[x.rfind("[")+1: x.rfind("]")]).index.values)
455455
else:
456+
df_final.index = df_final.index.str.replace("\[", "(", regex=True).str.replace("\]", ")", regex=True)
456457
df_final["unit"] = (df_final.rename(index=lambda x:
457458
x[x.rfind("(")+1: x.rfind(")")]).index.values)
458459
df_final.index = df_final.index.str.replace(r" \(.*\)","", regex=True)
@@ -687,10 +688,14 @@ def clean_up_units(tech_data, value_column="", source=""):
687688

688689
tech_data.loc[tech_data.unit.str.contains("mio EUR"), value_column] *= 1e6
689690
tech_data.unit = tech_data.unit.str.replace("mio EUR", "EUR")
691+
692+
tech_data.loc[tech_data.unit.str.contains("mill. EUR"), value_column] *= 1e6
693+
tech_data.unit = tech_data.unit.str.replace("mill. EUR", "EUR")
690694

691695
tech_data.loc[tech_data.unit.str.contains("1000EUR"), value_column] *= 1e3
692696
tech_data.unit = tech_data.unit.str.replace("1000EUR", "EUR")
693697

698+
tech_data.unit = tech_data.unit.str.replace("k EUR", "kEUR")
694699
tech_data.loc[tech_data.unit.str.contains("kEUR"), value_column] *= 1e3
695700
tech_data.unit = tech_data.unit.str.replace("kEUR", "EUR")
696701

@@ -989,6 +994,7 @@ def order_data(tech_data):
989994
(df.unit=="EUR/MWh/km") |
990995
(df.unit=="EUR/MWh") |
991996
(df.unit=="EUR/MWhoutput") |
997+
(df.unit=="EUR/MWh_CH4") |
992998
(tech == "biogas upgrading"))].copy()
993999
if len(vom)==1:
9941000
vom.loc[:,"parameter"] = "VOM"
@@ -1898,10 +1904,11 @@ def add_energy_storage_database(costs, data_year):
18981904
agg = df.loc[power_filter].groupby(["technology", "year"]).sum(numeric_only=True)
18991905
charger_investment_filter = charger_filter & (df.technology==tech) & (df.parameter=="investment")
19001906
discharger_investment_filter = discharger_filter & (df.technology==tech) & (df.parameter=="investment")
1901-
df.loc[charger_investment_filter & df.year==2021, "value"] += agg.loc[(tech, 2021)]/2
1902-
df.loc[charger_investment_filter & df.year==2030, "value"] += agg.loc[(tech, 2030)]/2
1903-
df.loc[discharger_investment_filter & df.year==2021, "value"] += agg.loc[(tech, 2021)]/2
1904-
df.loc[discharger_investment_filter & df.year==2030, "value"] += agg.loc[(tech, 2030)]/2
1907+
for a in [2021, 2030]:
1908+
df_year = (df.year == a)
1909+
df.loc[charger_investment_filter & df_year, "value"] += agg.loc[(tech, a)]/2
1910+
df.loc[discharger_investment_filter & df_year, "value"] += agg.loc[(tech, a)]/2
1911+
19051912
df.loc[:,"technology"] = df["technology"] + "-" + df["technology_type"]
19061913

19071914
# aggregate technology_type and unit

0 commit comments

Comments
 (0)