Skip to content

Commit

Permalink
Fix osm versions (#1498)
Browse files Browse the repository at this point in the history
* fix: make previous OSM versions compatible

* fix: fix osm data file suffix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
FabianHofmann and pre-commit-ci[bot] authored Jan 15, 2025
1 parent 62afc9e commit 39b0f07
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions rules/retrieve.smk
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,15 @@ if config["enable"]["retrieve"] and (
config["electricity"]["base_network"] == "osm-prebuilt"
):
OSM_VERSION = config["electricity"]["osm-prebuilt-version"]
OSM_COMPONENTS = ["buses", "converters", "lines", "links", "transformers"]
OSM_FILES = [
"buses.csv",
"converters.csv",
"lines.csv",
"links.csv",
"transformers.csv",
]
if OSM_VERSION >= 0.6:
OSM_COMPONENTS.append("map")
OSM_FILES.append("map.html")
OSM_ZENODO_IDS = {
0.1: "12799202",
0.2: "13342577",
Expand All @@ -555,17 +561,14 @@ if config["enable"]["retrieve"] and (
# update rule to use the correct version
rule retrieve_osm_prebuilt:
input:
[
storage(
f"https://zenodo.org/records/{OSM_ZENODO_IDS[OSM_VERSION]}/files/{component}.csv"
**{
file: storage(
f"https://zenodo.org/records/{OSM_ZENODO_IDS[OSM_VERSION]}/files/{file}"
)
for component in OSM_COMPONENTS
],
for file in OSM_FILES
},
output:
[
f"data/osm-prebuilt/{OSM_VERSION}/{component}.csv"
for component in OSM_COMPONENTS
],
**{file: f"data/osm-prebuilt/{OSM_VERSION}/{file}" for file in OSM_FILES},
log:
"logs/retrieve_osm_prebuilt.log",
threads: 1
Expand Down

0 comments on commit 39b0f07

Please sign in to comment.