Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write shapes to .nc-files #1012

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions scripts/base_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,16 @@ 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,
eg_converters,
Expand Down Expand Up @@ -758,13 +768,19 @@ 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():
import os

from _helpers import mock_snakemake

os.chdir(os.path.dirname(os.path.abspath(__file__)))

snakemake = mock_snakemake("base_network")
configure_logging(snakemake)
set_scenario_config(snakemake)
Expand Down
Loading