Merge branch 'master' into introduce_modularity_clustering

This commit is contained in:
Martha Frysztacki 2022-07-19 09:51:06 +02:00 committed by GitHub
commit b63385444c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,7 +122,7 @@ Exemplary unsolved network clustered to 37 nodes:
""" """
import logging import logging
from _helpers import configure_logging, update_p_nom_max, get_aggregation_strategies, REGION_COLS from _helpers import configure_logging, update_p_nom_max, get_aggregation_strategies
import pypsa import pypsa
import os import os
@ -375,9 +375,8 @@ def cluster_regions(busmaps, input=None, output=None):
for which in ('regions_onshore', 'regions_offshore'): for which in ('regions_onshore', 'regions_offshore'):
regions = gpd.read_file(getattr(input, which)) regions = gpd.read_file(getattr(input, which))
regions = regions.reindex(columns=REGION_COLS).set_index('name') regions = regions.reindex(columns=["name", "geometry"]).set_index('name')
aggfunc = dict(x="mean", y="mean", country="first") regions_c = regions.dissolve(busmap)
regions_c = regions.dissolve(busmap, aggfunc=aggfunc)
regions_c.index.name = 'name' regions_c.index.name = 'name'
regions_c = regions_c.reset_index() regions_c = regions_c.reset_index()
regions_c.to_file(getattr(output, which)) regions_c.to_file(getattr(output, which))