Skip to content

Commit

Permalink
store gas network with two letter buses not three letter
Browse files Browse the repository at this point in the history
  • Loading branch information
yerbol-akhmetov committed Nov 17, 2024
1 parent 9fd7e52 commit 0d12bb1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions scripts/prepare_gas_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
BASE_DIR,
content_retrieve,
progress_retrieve,
three_2_two_digits_country,
two_2_three_digits_country,
)
from build_shapes import gadm
Expand Down Expand Up @@ -915,13 +916,17 @@ def check_existence(row):
)

# Conversion of GADM id to from 3 to 2-digit
# pipelines["bus0"] = pipelines["bus0"].apply(
# lambda id: three_2_two_digits_country(id[:3]) + id[3:]
# )
pipelines["bus0"] = (
pipelines["bus0"]
.str.split(".")
.apply(lambda id: three_2_two_digits_country(id[0]) + "." + id[1])
)

# pipelines["bus1"] = pipelines["bus1"].apply(
# lambda id: three_2_two_digits_country(id[:3]) + id[3:]
# )
pipelines["bus1"] = (
pipelines["bus1"]
.str.split(".")
.apply(lambda id: three_2_two_digits_country(id[0]) + "." + id[1])
)

pipelines.to_csv(snakemake.output.clustered_gas_network, index=False)

Expand Down

0 comments on commit 0d12bb1

Please sign in to comment.