For 2D-embedded graph `G`, within the boundary given by the shapely polygon `outline`, returns `G` with the Voronoi cell region as an additional node attribute. """ #following line from vresutils.graph caused a bug #G = polygon_subgraph(G, outline, copy=False) points = list(vresutils.graph.get_node_attributes(G, 'pos').values()) regions = vresutils.graph.voronoi_partition_pts(points, outline, no_multipolygons=True) nx.set_node_attributes(G, 'region', dict(zip(G.nodes(), regions))) return G voronoi_partition(graph, poly) #NB: starts at midnight CET, 23:00 UTC load = DEload.timeseries(graph, years=[2011, 2012, 2013, 2014]) #Kill the Timezone information to avoid pandas bugs load.index = load.index.values #Take the first year (in UTC time - we don't set time zone because of a Pandas bug) network.set_snapshots(pd.date_range("2011-01-01 00:00","2011-12-31 23:00",freq="H")) network.now = network.snapshots[0] print(network.snapshots) #temporary load scaling factor for Germany load in relation to ENTSO-E hourly load #based roughly on Schumacher & Hirth (2015) #http://www.feem.it/userfiles/attach/20151191122284NDL2015-088.pdf #In principle rescaling should happen on a monthly basis
""" #following line from vresutils.graph caused a bug #G = polygon_subgraph(G, outline, copy=False) points = list(vresutils.graph.get_node_attributes(G, 'pos').values()) regions = vresutils.graph.voronoi_partition_pts(points, outline, no_multipolygons=True) nx.set_node_attributes(G, 'region', dict(zip(G.nodes(), regions))) return G voronoi_partition(graph, poly) #NB: starts at midnight CET, 23:00 UTC load = DEload.timeseries(graph, years=[2011, 2012, 2013, 2014]) #Kill the Timezone information to avoid pandas bugs load.index = load.index.values #Take the first year (in UTC time - we don't set time zone because of a Pandas bug) network.set_snapshots( pd.date_range("2011-01-01 00:00", "2011-12-31 23:00", freq="H")) print(network.snapshots) #temporary load scaling factor for Germany load in relation to ENTSO-E hourly load #based roughly on Schumacher & Hirth (2015) #http://www.feem.it/userfiles/attach/20151191122284NDL2015-088.pdf #In principle rescaling should happen on a monthly basis