Skip to content

Commit

Permalink
Review Changes:
Browse files Browse the repository at this point in the history
rename download rules
  • Loading branch information
SimonS898 committed Mar 2, 2024
1 parent 138b72c commit 6e9a82c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ wildcard_constraints:
resolution = "continental|national|regional"

ruleorder: area_to_capacity_limits > hydro_capacities > biofuels > nuclear_regional_capacity > dummy_tech_locations_template
ruleorder: bio_techs_and_locations_template > techs_and_locations_template > jrc_idees_zipped
ruleorder: bio_techs_and_locations_template > techs_and_locations_template > download_jrc_idees_zipped

ALL_CF_TECHNOLOGIES = [
"wind-onshore", "wind-offshore", "open-field-pv",
Expand Down
40 changes: 20 additions & 20 deletions rules/download.smk
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
localrules: ch_data_xlsx, eurostat_annual_energy_balances, jrc_idees_zipped

localrules: download_ch_energy_balances,download_eurostat_annual_energy_balances,download_jrc_idees_zipped

"Rules regarding CH Data:"
rule ch_data_xlsx:

rule download_ch_energy_balances:
message: "Get {wildcards.dataset} from Swiss statistics"
params:
url = lambda wildcards: config["data-sources"]["swiss-stat"][wildcards.dataset]
url=lambda wildcards: config["data-sources"]["swiss-stat"][wildcards.dataset]
output: protected("data/automatic/ch-{dataset}.xlsx")
shell: "curl -sLo {output} {params.url}"


"Rules regarding Eurostat Data:"

rule eurostat_annual_energy_balances:
message: "Get Annual Energy Balances from Eurostat"
rule download_eurostat_annual_energy_balances:
message: "Download Eurostat Annual Energy Balances from euro-calliope datasets"
params:
url = lambda wildcards: config["data-sources"]["eurostat-energy-balance"]
url=config["data-sources"]["eurostat-energy-balance"]
output: protected("data/automatic/eurostat-energy-balance.tsv.gz")
shell: "curl -sLo {output} {params.url}"

rule annual_energy_balances:
message: "Get annual energy balances from Eurostat"
input:
energy_balance = "data/automatic/eurostat-energy-balance.tsv.gz",
ch_energy_balance = "data/automatic/ch-energy-balance.xlsx",
ch_industry_energy_balance = "data/automatic/ch-industry-energy-balance.xlsx",
cat_names = "config/energy-balances/energy-balance-category-names.csv",
carrier_names = "config/energy-balances/energy-balance-carrier-names.csv"
energy_balance="data/automatic/eurostat-energy-balance.tsv.gz",
ch_energy_balance="data/automatic/ch-energy-balance.xlsx",
ch_industry_energy_balance="data/automatic/ch-industry-energy-balance.xlsx",
cat_names="config/energy-balances/energy-balance-category-names.csv",
carrier_names="config/energy-balances/energy-balance-carrier-names.csv"
output: "build/data/annual-energy-balances.csv"
params:
countries = config["scope"]["spatial"]["countries"]
countries=config["scope"]["spatial"]["countries"]
conda: "../envs/default.yaml"
script: "../scripts/eurostat/annual_energy_balance.py"

Expand All @@ -43,9 +43,9 @@ EU28 = [
"SE", "SI", "SK", "UK"
]

rule jrc_idees_zipped:
rule download_jrc_idees_zipped:
message: "Download JRC IDEES zip file for {wildcards.country_code}"
params: url = config["data-sources"]["jrc-idees"]
params: url=config["data-sources"]["jrc-idees"]
output: protected("data/automatic/jrc-idees/{country_code}.zip")
conda: "../envs/shell.yaml"
shell: "curl -sLo {output} '{params.url}'"
Expand All @@ -54,17 +54,17 @@ rule jrc_idees_zipped:
rule jrc_idees_unzipped:
message: "Unzip all JRC-IDEES {wildcards.sector} sector country data"
input:
countries = [
countries=[
f"data/automatic/jrc-idees/{country_code}.zip"
for country_code in [
pycountry.countries.lookup(country).alpha_2 if pycountry.countries.lookup(country).name != "Greece" else "EL"
for country in config["scope"]["spatial"]["countries"]
]
if country_code in EU28
]
params: sector_title_case = lambda wildcards: wildcards.sector.title()
params: sector_title_case=lambda wildcards: wildcards.sector.title()
wildcard_constraints:
sector = "((industry)|(transport)|(tertiary))"
sector="(transport)"
output: temp(directory("build/data/jrc-idees/{sector}/unprocessed"))
conda: "../envs/shell.yaml"
shell: "unzip 'data/automatic/jrc-idees/*.zip' '*{params.sector_title_case}*' -d {output}"
Expand All @@ -73,9 +73,9 @@ rule jrc_idees_unzipped:
rule jrc_idees_transport_processed:
message: "Process {wildcards.dataset} transport data from JRC-IDEES to be used in understanding current and future transport demand"
input:
unprocessed_data = "build/data/jrc-idees/transport/unprocessed"
unprocessed_data="build/data/jrc-idees/transport/unprocessed"
output: "build/data/jrc-idees/transport/processed-{dataset}.csv"
wildcard_constraints:
dataset = "((road-energy)|(road-distance)|(road-vehicles))"
dataset="((road-energy)|(road-distance)|(road-vehicles))"
conda: "../envs/default.yaml"
script: "../scripts/transport/jrc_idees.py"

0 comments on commit 6e9a82c

Please sign in to comment.