build_carbon_budget: parse input_co2

This commit is contained in:
Fabian Neumann 2023-08-22 14:49:44 +02:00
parent 401fbb7be7
commit 3ccc63aae4
3 changed files with 10 additions and 5 deletions

View File

@ -711,5 +711,5 @@ if __name__ == "__main__":
if snakemake.params.foresight == "myopic": if snakemake.params.foresight == "myopic":
cumulative_cost = calculate_cumulative_cost() cumulative_cost = calculate_cumulative_cost()
cumulative_cost.to_csv( cumulative_cost.to_csv(
"results/" + snakemake.params.RDIR + "/csvs/cumulative_cost.csv" "results/" + snakemake.params.RDIR + "csvs/cumulative_cost.csv"
) )

View File

@ -549,7 +549,7 @@ def plot_carbon_budget_distribution(input_eurostat):
fancybox=True, fontsize=18, loc=(0.01, 0.01), facecolor="white", frameon=True fancybox=True, fontsize=18, loc=(0.01, 0.01), facecolor="white", frameon=True
) )
path_cb_plot = "results/" + snakemake.params.RDIR + "/graphs/" path_cb_plot = "results/" + snakemake.params.RDIR + "graphs/"
plt.savefig(path_cb_plot + "carbon_budget_plot.pdf", dpi=300) plt.savefig(path_cb_plot + "carbon_budget_plot.pdf", dpi=300)

View File

@ -220,7 +220,7 @@ def co2_emissions_year(
# TODO: move to own rule with sector-opts wildcard? # TODO: move to own rule with sector-opts wildcard?
def build_carbon_budget(o, input_eurostat, fn, emissions_scope, report_year): def build_carbon_budget(o, input_eurostat, fn, emissions_scope, report_year, input_co2):
""" """
Distribute carbon budget following beta or exponential transition path. Distribute carbon budget following beta or exponential transition path.
""" """
@ -3402,13 +3402,18 @@ if __name__ == "__main__":
if "cb" not in o: if "cb" not in o:
continue continue
limit_type = "carbon budget" limit_type = "carbon budget"
fn = "results/" + snakemake.params.RDIR + "/csvs/carbon_budget_distribution.csv" fn = "results/" + snakemake.params.RDIR + "csvs/carbon_budget_distribution.csv"
if not os.path.exists(fn): if not os.path.exists(fn):
emissions_scope = snakemake.params.emissions_scope emissions_scope = snakemake.params.emissions_scope
report_year = snakemake.params.eurostat_report_year report_year = snakemake.params.eurostat_report_year
input_co2 = snakemake.input.co2 input_co2 = snakemake.input.co2
build_carbon_budget( build_carbon_budget(
o, snakemake.input.eurostat, fn, emissions_scope, report_year o,
snakemake.input.eurostat,
fn,
emissions_scope,
report_year,
input_co2,
) )
co2_cap = pd.read_csv(fn, index_col=0).squeeze() co2_cap = pd.read_csv(fn, index_col=0).squeeze()
limit = co2_cap.loc[investment_year] limit = co2_cap.loc[investment_year]