Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smk: use storage() only in combination with retrieve rules #1274

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Release Notes

* bugfix: The oil generator was incorrectly dropped when the config `oil_refining_emissions` was greater than zero. This was the default behaviour in 0.12.0.

* Uses of Snakemake's ``storage()`` function are integrated into retrieval
rules. This simplifies the use of ``mock_snakemake`` and places downloaded
data more transparently into the ``data`` directory.

PyPSA-Eur 0.12.0 (30th August 2024)
===================================

Expand Down
19 changes: 4 additions & 15 deletions rules/build_sector.smk
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,7 @@ rule build_biomass_potentials:
params:
biomass=config_provider("biomass"),
input:
enspreso_biomass=storage(
"https://zenodo.org/records/10356004/files/ENSPRESO_BIOMASS.xlsx",
keep_local=True,
),
enspreso_biomass="data/ENSPRESO_BIOMASS.xlsx",
eurostat="data/eurostat/Balances-April2023",
nuts2="data/bundle/nuts/NUTS_RG_10M_2013_4326_LEVL_2.geojson",
regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
Expand Down Expand Up @@ -458,10 +455,7 @@ rule build_sequestration_potentials:
"sector", "regional_co2_sequestration_potential"
),
input:
sequestration_potential=storage(
"https://raw.githubusercontent.com/ericzhou571/Co2Storage/main/resources/complete_map_2020_unit_Mt.geojson",
keep_local=True,
),
sequestration_potential="data/omplete_map_2020_unit_Mt.geojson",
regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
regions_offshore=resources("regions_offshore_elec_s{simpl}_{clusters}.geojson"),
output:
Expand Down Expand Up @@ -503,9 +497,7 @@ rule build_salt_cavern_potentials:

rule build_ammonia_production:
input:
usgs=storage(
"https://d9-wret.s3.us-west-2.amazonaws.com/assets/palladium/production/s3fs-public/media/files/myb1-2022-nitro-ert.xlsx"
),
usgs="data/myb1-2022-nitro-ert.xlsx",
output:
ammonia_production=resources("ammonia_production.csv"),
threads: 1
Expand Down Expand Up @@ -634,10 +626,7 @@ rule build_industrial_distribution_key:
input:
regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
clustered_pop_layout=resources("pop_layout_elec_s{simpl}_{clusters}.csv"),
hotmaps=storage(
"https://gitlab.com/hotmaps/industrial_sites/industrial_sites_Industrial_Database/-/raw/master/data/Industrial_Database.csv",
keep_local=True,
),
hotmaps="data/Industrial_Database.csv",
gem_gspt="data/gem/Global-Steel-Plant-Tracker-April-2024-Standard-Copy-V1.xlsx",
ammonia="data/ammonia_plants.csv",
cement_supplement="data/cement-plants-noneu.csv",
Expand Down
59 changes: 59 additions & 0 deletions rules/retrieve.smk
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,65 @@ if config["enable"]["retrieve"]:
validate_checksum(output[0], input[0])


if config["enable"]["retrieve"]:

rule retrieve_jrc_enspreso_biomass:
input:
storage(
"https://zenodo.org/records/10356004/files/ENSPRESO_BIOMASS.xlsx",
keep_local=True,
),
output:
"data/ENSPRESO_BIOMASS.xlsx",
retries: 1
run:
move(input[0], output[0])


if config["enable"]["retrieve"]:

rule retrieve_hotmaps_industrial_sites:
input:
storage(
"https://gitlab.com/hotmaps/industrial_sites/industrial_sites_Industrial_Database/-/raw/master/data/Industrial_Database.csv",
keep_local=True,
),
output:
"data/Industrial_Database.csv",
retries: 1
run:
move(input[0], output[0])


if config["enable"]["retrieve"]:

rule retrieve_usgs_ammonia_production:
input:
storage(
"https://d9-wret.s3.us-west-2.amazonaws.com/assets/palladium/production/s3fs-public/media/files/myb1-2022-nitro-ert.xlsx"
),
output:
"data/myb1-2022-nitro-ert.xlsx",
retries: 1
run:
move(input[0], output[0])


if config["enable"]["retrieve"]:

rule retrieve_geological_co2_storage_potential:
input:
storage(
"https://raw.githubusercontent.com/ericzhou571/Co2Storage/main/resources/complete_map_2020_unit_Mt.geojson",
keep_local=True,
),
output:
"data/complete_map_2020_unit_Mt.geojson",
retries: 1
run:
move(input[0], output[0])


if config["enable"]["retrieve"]:

# Downloading Copernicus Global Land Cover for land cover and land use:
Expand Down
Loading