Skip to content

Commit 33b1711

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 4409e75 commit 33b1711

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

scripts/compile_cost_assumptions.py

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@
153153
"electrolysis small": "86 AEC 10 MW",
154154
"gas storage": "150 Underground Storage of Gas",
155155
"biomethanation": "106 Biomethanation of biogas",
156-
157156
}
158157
# [DEA-sheet-names]
159158

@@ -1314,12 +1313,13 @@ def unify_diw(cost_dataframe: pd.DataFrame) -> pd.DataFrame:
13141313

13151314

13161315
def biomethanation_dea(df):
1317-
"""This function does:
1316+
"""
1317+
This function does:
13181318
- import DEA data for biomethanation (4H2 + CO2 -> CH4 + 2H2O)
13191319
- recalculates cost and inputs per MW of H2 added (bus 0 is H2)
13201320
"""
13211321

1322-
CO2_density = 1.98 / 1000 # kg/Nm3
1322+
CO2_density = 1.98 / 1000 # kg/Nm3
13231323
CH4_vol = 0.58 # biogas vol%, from DEA source for biomethanation
13241324
CO2_vol = 0.42 # biogas vol%, from DEA source for biomethanation
13251325
CH4_lhv = 35.8 / 3600 # MWh/Nm3
@@ -1349,12 +1349,14 @@ def biomethanation_dea(df):
13491349
df.loc[idx3[0]] = df.loc[idx3[0]].astype(float) * CO2_density # tCO2 / h / MW_H2
13501350

13511351
# Biogas input in MWh/MWh_H2
1352-
df.loc['Biogas Consumption, [MWh_th/MWh_H2]'] = (
1352+
df.loc["Biogas Consumption, [MWh_th/MWh_H2]"] = (
13531353
df.loc[idx3[0]].astype(float) / CO2_biogas
13541354
)
13551355

13561356
# Add biogas back to methane output (correct total output)
1357-
df.loc[idx4] = df.loc[idx4].astype(float) + df.loc['Biogas Consumption, [MWh_th/MWh_H2]']
1357+
df.loc[idx4] = (
1358+
df.loc[idx4].astype(float) + df.loc["Biogas Consumption, [MWh_th/MWh_H2]"]
1359+
)
13581360

13591361
# change unit to H2 basis
13601362
df.index = df.index.str.replace(" Total Input", "_H2")
@@ -1389,7 +1391,9 @@ def biomethanation_dea(df):
13891391
if not matches.empty:
13901392
old_index = matches[0]
13911393
updated_index = old_index.replace(old_label, new_label)
1392-
updated_index = updated_index.replace(old_units[old_label], new_units[old_label])
1394+
updated_index = updated_index.replace(
1395+
old_units[old_label], new_units[old_label]
1396+
)
13931397
df.rename(index={old_index: updated_index}, inplace=True)
13941398

13951399
return df
@@ -2013,7 +2017,7 @@ def order_data(years: list, technology_dataframe: pd.DataFrame) -> pd.DataFrame:
20132017
| (df.unit == "EUR/MW input")
20142018
| (df.unit == "EUR/MW-methanol")
20152019
| (df.unit == "EUR/t_N2/h") # air separation unit
2016-
| (df.unit == 'EUR/MW_H2')
2020+
| (df.unit == "EUR/MW_H2")
20172021
| (df.unit == "EUR/MW_biochar")
20182022
)
20192023
].copy()
@@ -2048,7 +2052,7 @@ def order_data(years: list, technology_dataframe: pd.DataFrame) -> pd.DataFrame:
20482052
| (df.unit == "EUR/MW_MeOH/year")
20492053
| (df.unit == "EUR/MW_CH4/year")
20502054
| (df.unit == "EUR/MW_biochar/year")
2051-
| (df.unit == 'EUR/MW_H2/year')
2055+
| (df.unit == "EUR/MW_H2/year")
20522056
| (df.unit == "% of specific investment/year")
20532057
| (df.unit == investment.unit.str.split(" ").iloc[0][0] + "/year")
20542058
)
@@ -2097,7 +2101,7 @@ def order_data(years: list, technology_dataframe: pd.DataFrame) -> pd.DataFrame:
20972101
| (df.unit == "EUR/MWhoutput")
20982102
| (df.unit == "EUR/MWh_CH4")
20992103
| (df.unit == "EUR/MWh_biochar")
2100-
| (df.unit == 'EUR/MWh_H2')
2104+
| (df.unit == "EUR/MWh_H2")
21012105
| (tech_name == "biogas upgrading")
21022106
)
21032107
].copy()
@@ -2306,22 +2310,32 @@ def order_data(years: list, technology_dataframe: pd.DataFrame) -> pd.DataFrame:
23062310
clean_df[tech_name] = pd.concat([clean_df[tech_name], efficiency_heat])
23072311

23082312
elif tech_name == "biomethanation":
2309-
h2_input = efficiency[efficiency.index.str.contains("Hydrogen Input")].copy()
2313+
h2_input = efficiency[
2314+
efficiency.index.str.contains("Hydrogen Input")
2315+
].copy()
23102316
h2_input["parameter"] = "Hydrogen Input"
23112317
clean_df[tech_name] = pd.concat([clean_df[tech_name], h2_input])
23122318
co2_input = efficiency[efficiency.index.str.contains("CO2 Input")].copy()
23132319
co2_input["parameter"] = "CO2 Input"
23142320
clean_df[tech_name] = pd.concat([clean_df[tech_name], co2_input])
2315-
efficiency_heat_out = efficiency[efficiency.index.str.contains("H-Output")].copy()
2321+
efficiency_heat_out = efficiency[
2322+
efficiency.index.str.contains("H-Output")
2323+
].copy()
23162324
efficiency_heat_out["parameter"] = "heat output"
23172325
clean_df[tech_name] = pd.concat([clean_df[tech_name], efficiency_heat_out])
2318-
biomass_input = efficiency[efficiency.index.str.contains("Methane Output")].copy()
2326+
biomass_input = efficiency[
2327+
efficiency.index.str.contains("Methane Output")
2328+
].copy()
23192329
biomass_input["parameter"] = "Methane Output"
23202330
clean_df[tech_name] = pd.concat([clean_df[tech_name], biomass_input])
2321-
electricity_input = efficiency[efficiency.index.str.contains("El-Input")].copy()
2331+
electricity_input = efficiency[
2332+
efficiency.index.str.contains("El-Input")
2333+
].copy()
23222334
electricity_input["parameter"] = "electricity input"
23232335
clean_df[tech_name] = pd.concat([clean_df[tech_name], electricity_input])
2324-
biogas_input = efficiency[efficiency.index.str.contains("Biogas Consumption")].copy()
2336+
biogas_input = efficiency[
2337+
efficiency.index.str.contains("Biogas Consumption")
2338+
].copy()
23252339
biogas_input["parameter"] = "Biogas Input"
23262340
clean_df[tech_name] = pd.concat([clean_df[tech_name], biogas_input])
23272341

0 commit comments

Comments
 (0)