diff --git a/scripts/prepare_gas_network.py b/scripts/prepare_gas_network.py index cbdcd120a..27071c1f3 100644 --- a/scripts/prepare_gas_network.py +++ b/scripts/prepare_gas_network.py @@ -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 @@ -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)