From bfeb429c27b6ea1e9456d264568c9a8ed9a7ab18 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 25 May 2021 15:55:39 +0200 Subject: [PATCH] base: add escape if all TYNDP links already in network (#246) --- doc/release_notes.rst | 1 + scripts/base_network.py | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 02b79cd7..2251c853 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -19,6 +19,7 @@ Upcoming Release * Fix: Value for ``co2base`` in ``config.yaml`` adjusted to 1.487e9 t CO2-eq (from 3.1e9 t CO2-eq). The new value represents emissions related to the electricity sector for EU+UK. The old value was ~2x too high and used when the emissions wildcard in ``{opts}`` was used. * Add option to include marginal costs of links representing fuel cells, electrolysis, and battery inverters [`#232 `_]. +* Fix: Add escape in :mod:`base_network` if all TYNDP links are already contained in the network [`#246 `_]. * Bugfix in :mod:`solve_operations_network`: optimised capacities are now fixed for all extendable links, not only HVDC links [`#244 `_]. * The ``focus_weights`` are now also considered when pre-clustering in the :mod:`simplify_network` rule [`#241 `_]. diff --git a/scripts/base_network.py b/scripts/base_network.py index c35b6858..778f8dc4 100644 --- a/scripts/base_network.py +++ b/scripts/base_network.py @@ -212,6 +212,7 @@ def _add_links_from_tyndp(buses, links): if links_tyndp["j"].notnull().any(): logger.info("TYNDP links already in the dataset (skipping): " + ", ".join(links_tyndp.loc[links_tyndp["j"].notnull(), "Name"])) links_tyndp = links_tyndp.loc[links_tyndp["j"].isnull()] + if links_tyndp.empty: return buses, links tree = sp.spatial.KDTree(buses[['x', 'y']]) _, ind0 = tree.query(links_tyndp[["x1", "y1"]])