From 4465330e06e50c818e85905c069c2721430e30f1 Mon Sep 17 00:00:00 2001 From: Ben van Basten Date: Mon, 11 Nov 2024 18:30:21 +0100 Subject: [PATCH] Added check whether outlet code exists in connection nodes. --- CHANGES.rst | 2 +- hydxlib/exporter.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index c73ad46..acdbc5e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,7 @@ Changelog of hydxlib 1.5.3 (unreleased) ------------------ -- Nothing changed yet. +- Added check whether outlet code exists in connection nodes. 1.5.2 (2024-03-21) diff --git a/hydxlib/exporter.py b/hydxlib/exporter.py index a647ec2..63eb927 100644 --- a/hydxlib/exporter.py +++ b/hydxlib/exporter.py @@ -237,7 +237,11 @@ def write_threedi_to_db(threedi, threedi_db_settings): # because of constraints) TO DO: bounds aan meerdere leidingen overslaan outlet_list = [] for outlet in threedi.outlets: - outlet["connection_node_id"] = connection_node_dict[outlet["node.code"]] + if outlet["node.code"] in connection_node_dict: + outlet["connection_node_id"] = connection_node_dict[outlet["node.code"]] + else: + outlet["connection_node_id"] = None + logger.error("Node of outlet not found in connection nodes") del outlet["node.code"] outlet_list.append(BoundaryCondition1D(**outlet))