remove snakemake from function
This commit is contained in:
parent
b9c58db0ba
commit
b50954aee4
@ -197,17 +197,17 @@ def get(item, investment_year=None):
|
|||||||
|
|
||||||
|
|
||||||
def co2_emissions_year(
|
def co2_emissions_year(
|
||||||
countries, input_eurostat, opts, emissions_scope, report_year, year
|
countries, input_eurostat, input_eea, opts, emissions_scope, report_year, year
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Calculate CO2 emissions in one specific year (e.g. 1990 or 2018).
|
Calculate CO2 emissions in one specific year (e.g. 1990 or 2018).
|
||||||
"""
|
"""
|
||||||
emissions_scope = snakemake.config["energy"]["emissions"]
|
|
||||||
eea_co2 = build_eea_co2(snakemake.input.co2, year, emissions_scope)
|
eea_co2 = build_eea_co2(input_eea, year, emissions_scope)
|
||||||
|
|
||||||
# TODO: read Eurostat data from year > 2014
|
# TODO: read Eurostat data from year > 2014
|
||||||
# this only affects the estimation of CO2 emissions for BA, RS, AL, ME, MK
|
# this only affects the estimation of CO2 emissions for BA, RS, AL, ME, MK
|
||||||
report_year = snakemake.config["energy"]["eurostat_report_year"]
|
|
||||||
if year > 2014:
|
if year > 2014:
|
||||||
eurostat_co2 = build_eurostat_co2(
|
eurostat_co2 = build_eurostat_co2(
|
||||||
input_eurostat, countries, report_year, year=2014
|
input_eurostat, countries, report_year, year=2014
|
||||||
@ -228,7 +228,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, input_eea, fn, emissions_scope, report_year):
|
||||||
"""
|
"""
|
||||||
Distribute carbon budget following beta or exponential transition path.
|
Distribute carbon budget following beta or exponential transition path.
|
||||||
"""
|
"""
|
||||||
@ -246,12 +246,12 @@ def build_carbon_budget(o, input_eurostat, fn, emissions_scope, report_year):
|
|||||||
countries = snakemake.config["countries"]
|
countries = snakemake.config["countries"]
|
||||||
|
|
||||||
e_1990 = co2_emissions_year(
|
e_1990 = co2_emissions_year(
|
||||||
countries, input_eurostat, opts, emissions_scope, report_year, year=1990
|
countries, input_eurostat, input_eea, opts, emissions_scope, report_year, year=1990
|
||||||
)
|
)
|
||||||
|
|
||||||
# emissions at the beginning of the path (last year available 2018)
|
# emissions at the beginning of the path (last year available 2018)
|
||||||
e_0 = co2_emissions_year(
|
e_0 = co2_emissions_year(
|
||||||
countries, input_eurostat, opts, emissions_scope, report_year, year=2018
|
countries, input_eurostat, input_eea, opts, emissions_scope, report_year, year=2018
|
||||||
)
|
)
|
||||||
|
|
||||||
planning_horizons = snakemake.config["scenario"]["planning_horizons"]
|
planning_horizons = snakemake.config["scenario"]["planning_horizons"]
|
||||||
@ -3369,7 +3369,7 @@ if __name__ == "__main__":
|
|||||||
emissions_scope = snakemake.config["energy"]["emissions"]
|
emissions_scope = snakemake.config["energy"]["emissions"]
|
||||||
report_year = snakemake.config["energy"]["eurostat_report_year"]
|
report_year = snakemake.config["energy"]["eurostat_report_year"]
|
||||||
build_carbon_budget(
|
build_carbon_budget(
|
||||||
o, snakemake.input.eurostat, fn, emissions_scope, report_year
|
o, snakemake.input.eurostat, snakemake.input.co2, fn, emissions_scope, report_year
|
||||||
)
|
)
|
||||||
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]
|
||||||
|
Loading…
Reference in New Issue
Block a user