Skip to content

Commit

Permalink
Add Params to build_industry_demand
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddy-JV committed Jun 11, 2024
1 parent 22f56ba commit 087b344
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,12 @@ rule build_base_industry_totals: #default data


rule build_industry_demand: #default data
params:
countries= config["countries"],
industry_demand= config["custom_data"]["industry_demand"],
base_year= config["demand_data"]["base_year"],
industry_util_factor= config["sector"]["industry_util_factor"],
aluminium_year= config["demand_data"]["aluminium_year"],
input:
industrial_distribution_key="resources/demand/industrial_distribution_key_elec_s{simpl}_{clusters}.csv",
#industrial_production_per_country_tomorrow="resources/demand/industrial_production_per_country_tomorrow_{planning_horizons}_{demand}.csv",
Expand Down
10 changes: 5 additions & 5 deletions scripts/build_industry_demand.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def country_to_nodal(industrial_production, keys):

sets_path_to_root("pypsa-earth-sec")

countries = snakemake.config["countries"]
countries = snakemake.params.countries

if snakemake.config["custom_data"]["industry_demand"]:
if snakemake.params.industry_demand:
_logger.info(
"Fetching custom industry demand data.. expecting file at 'data_custom/industry_demand_{0}_{1}.csv'".format(
snakemake.wildcards["demand"], snakemake.wildcards["planning_horizons"]
Expand Down Expand Up @@ -102,7 +102,7 @@ def country_to_nodal(industrial_production, keys):

else:
no_years = int(snakemake.wildcards.planning_horizons) - int(
snakemake.config["demand_data"]["base_year"]
snakemake.params.base_year
)

cagr = read_csv_nafix(snakemake.input.industry_growth_cagr, index_col=0)
Expand Down Expand Up @@ -131,7 +131,7 @@ def country_to_nodal(industrial_production, keys):
# non-used line; commented out
# industry_totals = (production_tom * industry_base_totals).fillna(0)

industry_util_factor = snakemake.config["sector"]["industry_util_factor"]
industry_util_factor = snakemake.params.industry_util_factor

# Load distribution keys
keys_path = snakemake.input.industrial_distribution_key
Expand Down Expand Up @@ -208,7 +208,7 @@ def match_technology(df):
countries_geo = geo_locs.index.unique().intersection(countries)
geo_locs = match_technology(geo_locs).loc[countries_geo]

aluminium_year = snakemake.config["demand_data"]["aluminium_year"]
aluminium_year = snakemake.params.aluminium_year
AL = read_csv_nafix("data/AL_production.csv", index_col=0)
AL_prod_tom = AL.query("Year == @aluminium_year and index in @countries_geo")[
"production[ktons/a]"
Expand Down

0 comments on commit 087b344

Please sign in to comment.