Merge pull request #922 from PyPSA/bus-regions
create a bus for every unique coordinate, not only substations
This commit is contained in:
commit
dc14082985
@ -10,6 +10,11 @@ Release Notes
|
|||||||
Upcoming Release
|
Upcoming Release
|
||||||
================
|
================
|
||||||
|
|
||||||
|
* Regions are assigned to all buses with unique coordinates in the network with
|
||||||
|
a preference given to substations. Previously, only substations had assigned
|
||||||
|
regions, but this could lead to issues when a high spatial resolution was
|
||||||
|
applied.
|
||||||
|
|
||||||
* The default configuration ``config/config.default.yaml`` is now automatically
|
* The default configuration ``config/config.default.yaml`` is now automatically
|
||||||
used as a base configuration file and no longer copied to
|
used as a base configuration file and no longer copied to
|
||||||
``config/config.yaml`` on first use. The file ``config/config.yaml`` should be
|
``config/config.yaml`` on first use. The file ``config/config.yaml`` should be
|
||||||
|
@ -559,6 +559,7 @@ def _set_countries_and_substations(n, config, country_shapes, offshore_shapes):
|
|||||||
for b, df in product(("bus0", "bus1"), (n.lines, n.links)):
|
for b, df in product(("bus0", "bus1"), (n.lines, n.links)):
|
||||||
has_connections_b |= ~df.groupby(b).under_construction.min()
|
has_connections_b |= ~df.groupby(b).under_construction.min()
|
||||||
|
|
||||||
|
buses["onshore_bus"] = onshore_b
|
||||||
buses["substation_lv"] = (
|
buses["substation_lv"] = (
|
||||||
lv_b & onshore_b & (~buses["under_construction"]) & has_connections_b
|
lv_b & onshore_b & (~buses["under_construction"]) & has_connections_b
|
||||||
)
|
)
|
||||||
|
@ -135,7 +135,13 @@ if __name__ == "__main__":
|
|||||||
c_b = n.buses.country == country
|
c_b = n.buses.country == country
|
||||||
|
|
||||||
onshore_shape = country_shapes[country]
|
onshore_shape = country_shapes[country]
|
||||||
onshore_locs = n.buses.loc[c_b & n.buses.substation_lv, ["x", "y"]]
|
onshore_locs = (
|
||||||
|
n.buses.loc[c_b & n.buses.onshore_bus]
|
||||||
|
.sort_values(
|
||||||
|
by="substation_lv", ascending=False
|
||||||
|
) # preference for substations
|
||||||
|
.drop_duplicates(subset=["x", "y"], keep="first")[["x", "y"]]
|
||||||
|
)
|
||||||
onshore_regions.append(
|
onshore_regions.append(
|
||||||
gpd.GeoDataFrame(
|
gpd.GeoDataFrame(
|
||||||
{
|
{
|
||||||
|
@ -611,6 +611,7 @@ if __name__ == "__main__":
|
|||||||
"symbol",
|
"symbol",
|
||||||
"tags",
|
"tags",
|
||||||
"under_construction",
|
"under_construction",
|
||||||
|
"onshore_bus",
|
||||||
"substation_lv",
|
"substation_lv",
|
||||||
"substation_off",
|
"substation_off",
|
||||||
"geometry",
|
"geometry",
|
||||||
|
Loading…
Reference in New Issue
Block a user