Skip to content

Commit a59fab0

Browse files
committed
adjust inflation function
1 parent 286a3cb commit a59fab0

8 files changed

+1295
-1295
lines changed

outputs/costs_2020.csv

+184-184
Large diffs are not rendered by default.

outputs/costs_2025.csv

+184-184
Large diffs are not rendered by default.

outputs/costs_2030.csv

+184-184
Large diffs are not rendered by default.

outputs/costs_2035.csv

+184-184
Large diffs are not rendered by default.

outputs/costs_2040.csv

+184-184
Large diffs are not rendered by default.

outputs/costs_2045.csv

+184-184
Large diffs are not rendered by default.

outputs/costs_2050.csv

+184-184
Large diffs are not rendered by default.

scripts/compile_cost_assumptions.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -660,21 +660,21 @@ def adjust_for_inflation(inflation_rate, costs, techs, ref_year, col):
660660

661661
def get_factor(inflation_rate, ref_year, eur_year):
662662
if (pd.isna(ref_year)) or (ref_year<1900): return np.nan
663+
if ref_year == eur_year: return 1
663664
mean = inflation_rate.mean()
664-
if ref_year<= eur_year:
665-
new_index = np.arange(ref_year, eur_year+1)
665+
if ref_year< eur_year:
666+
new_index = np.arange(ref_year+1, eur_year+1)
666667
df = 1 + inflation_rate.reindex(new_index).fillna(mean)
667-
return df.cumprod().shift().fillna(1).loc[eur_year]
668+
return df.cumprod().loc[eur_year]
668669
else:
669-
new_index = np.arange(eur_year, ref_year+1)
670+
new_index = np.arange(eur_year+1, ref_year+1)
670671
df = 1 + inflation_rate.reindex(new_index).fillna(mean)
671-
return 1/df.cumprod().shift().fillna(1).loc[ref_year]
672+
return 1/df.cumprod().loc[ref_year]
672673

673-
inflation = costs_tot.currency_year.apply(lambda x: get_factor(inflation_rate, x, snakemake.config['eur_year']))
674+
inflation = costs.currency_year.apply(lambda x: get_factor(inflation_rate, x, snakemake.config['eur_year']))
674675

675676
paras = ["investment", "VOM", "fuel"]
676677
filter_i = costs.index.get_level_values(0).isin(techs) & costs.index.get_level_values(1).isin(paras)
677-
678678
costs.loc[filter_i, col] = costs.loc[filter_i, col].mul(inflation.loc[filter_i], axis=0)
679679

680680

0 commit comments

Comments
 (0)