@@ -646,7 +646,7 @@ def get_data_from_DEA(data_in, expectation=None):
646
646
647
647
return d_by_tech
648
648
649
- def adjust_for_inflation (costs , techs , ref_year , col ):
649
+ def adjust_for_inflation (inflation_rate , costs , techs , ref_year , col ):
650
650
"""
651
651
adjust the investment costs for the specified techs for inflation.
652
652
@@ -657,12 +657,25 @@ def adjust_for_inflation(costs, techs, ref_year, col):
657
657
costs: pd.Dataframe
658
658
Dataframe containing the costs data with multiindex on technology and one index key 'investment'.
659
659
"""
660
+
661
+ def get_factor (inflation_rate , ref_year , eur_year ):
662
+ if (pd .isna (ref_year )) or (ref_year < 1900 ): return np .nan
663
+ mean = inflation_rate .mean ()
664
+ if ref_year <= eur_year :
665
+ new_index = np .arange (ref_year , eur_year + 1 )
666
+ df = 1 + inflation_rate .reindex (new_index ).fillna (mean )
667
+ return df .cumprod ().shift ().fillna (1 ).loc [eur_year ]
668
+ else :
669
+ new_index = np .arange (eur_year , ref_year + 1 )
670
+ df = 1 + inflation_rate .reindex (new_index ).fillna (mean )
671
+ return 1 / df .cumprod ().shift ().fillna (1 ).loc [ref_year ]
672
+
673
+ inflation = costs_tot .currency_year .apply (lambda x : get_factor (inflation_rate , x , snakemake .config ['eur_year' ]))
660
674
661
- inflation = (1 + snakemake .config ['rate_inflation' ])** (ref_year - snakemake .config ['eur_year' ]).astype (float )
662
675
paras = ["investment" , "VOM" , "fuel" ]
663
676
filter_i = costs .index .get_level_values (0 ).isin (techs ) & costs .index .get_level_values (1 ).isin (paras )
664
677
665
- costs .loc [filter_i , col ] = costs .loc [filter_i , col ].div (inflation .loc [filter_i ], axis = 0 )
678
+ costs .loc [filter_i , col ] = costs .loc [filter_i , col ].mul (inflation .loc [filter_i ], axis = 0 )
666
679
667
680
668
681
return costs
@@ -1541,7 +1554,7 @@ def carbon_flow(costs,year):
1541
1554
VOM = costs .loc [('BtL' , 'VOM' ), 'value' ] + costs .loc [('Fischer-Tropsch' , 'VOM' ), 'value' ] * efuel_scale_factor
1542
1555
FOM = costs .loc [('BtL' , 'FOM' ), 'value' ]
1543
1556
medium_out = 'oil'
1544
- currency_year = costs .loc [('BtL ' , 'VOM ' ), "currency_year" ]
1557
+ currency_year = costs .loc [('Fischer-Tropsch ' , 'investment ' ), "currency_year" ]
1545
1558
source = "combination of BtL and electrofuels"
1546
1559
1547
1560
elif tech in ['biogas' , 'biogas CC' , 'biogas plus hydrogen' ]:
@@ -1574,7 +1587,7 @@ def carbon_flow(costs,year):
1574
1587
costs .loc [(tech , 'VOM' ), 'value' ] = VOM
1575
1588
costs .loc [(tech , 'VOM' ), 'unit' ] = "EUR/MWh_th"
1576
1589
costs .loc [(tech , 'VOM' ), 'source' ] = source
1577
- costs .loc [(tech , 'VOM' ), 'source ' ] = currency_year
1590
+ costs .loc [(tech , 'VOM' ), 'currency_year ' ] = currency_year
1578
1591
1579
1592
return costs
1580
1593
@@ -2103,6 +2116,18 @@ def geometric_series(nominator, denominator=1, number_of_terms=1, start=1):
2103
2116
return pd .concat ([costs , df ]), tech
2104
2117
2105
2118
2119
+ def prepare_inflation_rate (fn ):
2120
+ """read in annual inflation rate from Eurostat
2121
+ https://ec.europa.eu/eurostat/databrowser/view/teicp000/default/table?lang=en
2122
+ """
2123
+ inflation_rate = pd .read_excel (fn ,
2124
+ sheet_name = "Blatt 1" , index_col = 0 ,
2125
+ header = [8 ]).dropna (axis = 0 )
2126
+ inflation_rate .rename (index = lambda x : int (x ), inplace = True )
2127
+ inflation_rate = inflation_rate .astype (float )
2128
+
2129
+ return inflation_rate .iloc [:,0 ]/ 100
2130
+
2106
2131
# %% *************************************************************************
2107
2132
# ---------- MAIN ------------------------------------------------------------
2108
2133
if __name__ == "__main__" :
@@ -2113,6 +2138,9 @@ def geometric_series(nominator, denominator=1, number_of_terms=1, start=1):
2113
2138
snakemake = mock_snakemake ("compile_cost_assumptions" )
2114
2139
2115
2140
years = snakemake .config ['years' ]
2141
+ inflation_rate = prepare_inflation_rate (snakemake .input .inflation_rate )
2142
+
2143
+
2116
2144
2117
2145
# (1) DEA data
2118
2146
# (a)-------- get data from DEA excel sheets ----------------------------------
@@ -2280,7 +2308,9 @@ def geometric_series(nominator, denominator=1, number_of_terms=1, start=1):
2280
2308
2281
2309
# adjust for inflation
2282
2310
techs = costs_tot .index .get_level_values (0 ).unique ()
2283
- costs_tot = adjust_for_inflation (costs_tot , techs , costs_tot .currency_year , ["value" ])
2311
+ costs_tot ["currency_year" ] = costs_tot .currency_year .astype (float )
2312
+ costs_tot = adjust_for_inflation (inflation_rate , costs_tot , techs ,
2313
+ costs_tot .currency_year , ["value" ])
2284
2314
2285
2315
# format and sort
2286
2316
costs_tot .sort_index (inplace = True )
0 commit comments