write shapes to base network

This commit is contained in:
cpschau 2024-04-10 17:10:56 +02:00 committed by Fabian
parent e1502c95dd
commit 0ae016a7d0

View File

@ -697,6 +697,14 @@ def _adjust_capacities_of_under_construction_branches(n, config):
return n
def _set_shapes(n, country_shapes, offshore_shapes):
# Write the geodataframes country_shapes and offshore_shapes to the network.shapes component
country_shapes = gpd.read_file(country_shapes).rename(columns={"name": "idx"})
country_shapes["type"] = "country"
offshore_shapes = gpd.read_file(offshore_shapes).rename(columns={"name": "idx"})
offshore_shapes["type"] = "offshore"
all_shapes = pd.concat([country_shapes, offshore_shapes])
n.shapes = pd.concat([n.shapes, all_shapes])
def base_network(
eg_buses,
@ -758,12 +766,16 @@ def base_network(
n = _adjust_capacities_of_under_construction_branches(n, config)
_set_shapes(n, country_shapes, offshore_shapes)
return n
if __name__ == "__main__":
if "snakemake" not in globals():
from _helpers import mock_snakemake
import os
os.chdir(os.path.dirname(os.path.abspath(__file__)))
snakemake = mock_snakemake("base_network")
configure_logging(snakemake)