Make data retrieval rules use their own minimal conda env
This means that the main conda environment can be changed for development purposes without necessitating the re-running of data retrieval due to software environment change by default.
This commit is contained in:
parent
a9ac68b50e
commit
48974edc8d
13
envs/retrieve.yaml
Normal file
13
envs/retrieve.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# SPDX-FileCopyrightText: : 2017-2024 The PyPSA-Eur Authors
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
name: pypsa-eur-retrieve
|
||||||
|
channels:
|
||||||
|
- conda-forge
|
||||||
|
- bioconda
|
||||||
|
dependencies:
|
||||||
|
- python>=3.8
|
||||||
|
- snakemake-minimal>=7.7.0,<8.0.0
|
||||||
|
- pandas>=2.1
|
||||||
|
- tqdm
|
@ -37,7 +37,7 @@ if config["enable"]["retrieve"] and config["enable"].get("retrieve_databundle",
|
|||||||
mem_mb=1000,
|
mem_mb=1000,
|
||||||
retries: 2
|
retries: 2
|
||||||
conda:
|
conda:
|
||||||
"../envs/environment.yaml"
|
"../envs/retrieve.yaml"
|
||||||
script:
|
script:
|
||||||
"../scripts/retrieve_databundle.py"
|
"../scripts/retrieve_databundle.py"
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ if config["enable"].get("retrieve_irena"):
|
|||||||
mem_mb=1000,
|
mem_mb=1000,
|
||||||
retries: 2
|
retries: 2
|
||||||
conda:
|
conda:
|
||||||
"../envs/environment.yaml"
|
"../envs/retrieve.yaml"
|
||||||
script:
|
script:
|
||||||
"../scripts/retrieve_irena.py"
|
"../scripts/retrieve_irena.py"
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ if config["enable"]["retrieve"] and config["enable"].get(
|
|||||||
LOGS + "retrieve_sector_databundle.log",
|
LOGS + "retrieve_sector_databundle.log",
|
||||||
retries: 2
|
retries: 2
|
||||||
conda:
|
conda:
|
||||||
"../envs/environment.yaml"
|
"../envs/retrieve.yaml"
|
||||||
script:
|
script:
|
||||||
"../scripts/retrieve_sector_databundle.py"
|
"../scripts/retrieve_sector_databundle.py"
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ if config["enable"]["retrieve"]:
|
|||||||
LOGS + "retrieve_gas_infrastructure_data.log",
|
LOGS + "retrieve_gas_infrastructure_data.log",
|
||||||
retries: 2
|
retries: 2
|
||||||
conda:
|
conda:
|
||||||
"../envs/environment.yaml"
|
"../envs/retrieve.yaml"
|
||||||
script:
|
script:
|
||||||
"../scripts/retrieve_gas_infrastructure_data.py"
|
"../scripts/retrieve_gas_infrastructure_data.py"
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ if config["enable"]["retrieve"]:
|
|||||||
input:
|
input:
|
||||||
HTTP.remote(
|
HTTP.remote(
|
||||||
"data.open-power-system-data.org/time_series/{version}/time_series_60min_singleindex.csv".format(
|
"data.open-power-system-data.org/time_series/{version}/time_series_60min_singleindex.csv".format(
|
||||||
version="2019-06-05"
|
version="2019-06-05"
|
||||||
if config["snapshots"]["end"] < "2019"
|
if config["snapshots"]["end"] < "2019"
|
||||||
else "2020-10-06"
|
else "2020-10-06"
|
||||||
),
|
),
|
||||||
@ -316,7 +316,7 @@ if config["enable"]["retrieve"]:
|
|||||||
layer_path = (
|
layer_path = (
|
||||||
f"/vsizip/{params.folder}/WDPA_{bYYYY}_Public_shp_{i}.zip"
|
f"/vsizip/{params.folder}/WDPA_{bYYYY}_Public_shp_{i}.zip"
|
||||||
)
|
)
|
||||||
print(f"Adding layer {i+1} of 3 to combined output file.")
|
print(f"Adding layer {i + 1} of 3 to combined output file.")
|
||||||
shell("ogr2ogr -f gpkg -update -append {output.gpkg} {layer_path}")
|
shell("ogr2ogr -f gpkg -update -append {output.gpkg} {layer_path}")
|
||||||
|
|
||||||
rule download_wdpa_marine:
|
rule download_wdpa_marine:
|
||||||
@ -340,7 +340,7 @@ if config["enable"]["retrieve"]:
|
|||||||
for i in range(3):
|
for i in range(3):
|
||||||
# vsizip is special driver for directly working with zipped shapefiles in ogr2ogr
|
# vsizip is special driver for directly working with zipped shapefiles in ogr2ogr
|
||||||
layer_path = f"/vsizip/{params.folder}/WDPA_WDOECM_{bYYYY}_Public_marine_shp_{i}.zip"
|
layer_path = f"/vsizip/{params.folder}/WDPA_WDOECM_{bYYYY}_Public_marine_shp_{i}.zip"
|
||||||
print(f"Adding layer {i+1} of 3 to combined output file.")
|
print(f"Adding layer {i + 1} of 3 to combined output file.")
|
||||||
shell("ogr2ogr -f gpkg -update -append {output.gpkg} {layer_path}")
|
shell("ogr2ogr -f gpkg -update -append {output.gpkg} {layer_path}")
|
||||||
|
|
||||||
|
|
||||||
@ -376,6 +376,6 @@ if config["enable"]["retrieve"]:
|
|||||||
mem_mb=5000,
|
mem_mb=5000,
|
||||||
retries: 2
|
retries: 2
|
||||||
conda:
|
conda:
|
||||||
"../envs/environment.yaml"
|
"../envs/retrieve.yaml"
|
||||||
script:
|
script:
|
||||||
"../scripts/retrieve_monthly_fuel_prices.py"
|
"../scripts/retrieve_monthly_fuel_prices.py"
|
||||||
|
Loading…
Reference in New Issue
Block a user