From 2477e07b96153cd323de11d51d8b6e7c90ef67bd Mon Sep 17 00:00:00 2001 From: Martijn Siemerink Date: Wed, 18 Dec 2024 17:40:42 +0100 Subject: [PATCH] Found some quirks. --- threedigrid_builder/grid/quadtree.py | 4 ++-- threedigrid_builder/interface/gridadmin.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/threedigrid_builder/grid/quadtree.py b/threedigrid_builder/grid/quadtree.py index 4999c828..64123cbf 100644 --- a/threedigrid_builder/grid/quadtree.py +++ b/threedigrid_builder/grid/quadtree.py @@ -264,8 +264,8 @@ def get_quarters_admin(self, nodes, lines): np.isin(nodes.node_type, NodeType.NODE_2D_BOUNDARIES) ) - quarter_line = np.full((4 * n_2d_nodes, 2), 0, dtype=np.int32, order="F") - neighbour_node = np.full((4 * n_2d_nodes, 2), 0, dtype=np.int32, order="F") + quarter_line = np.full((4 * n_2d_nodes, 2), -9999, dtype=np.int32, order="F") + neighbour_node = np.full((4 * n_2d_nodes, 2), -9999, dtype=np.int32, order="F") m_cells.set_quarter_admin( nodes.nodk, diff --git a/threedigrid_builder/interface/gridadmin.py b/threedigrid_builder/interface/gridadmin.py index 139b955f..52f309ee 100644 --- a/threedigrid_builder/interface/gridadmin.py +++ b/threedigrid_builder/interface/gridadmin.py @@ -577,14 +577,17 @@ def write_quarters(self, quarters, group_name="quarters"): group = self._file.create_group(group_name) mask = quarters.id != -9999 quarters.id[mask] = quarters.id[mask] + 1 + quarters.id[~mask] = 0 self.write_dataset(group, "id", quarters.id) mask = quarters.line != -9999 quarters.line[mask] = quarters.line[mask] + 1 + quarters.line[~mask] = 0 self.write_dataset(group, "line", quarters.line.T) - mask = quarters.neighbour_node != 0 + mask = quarters.neighbour_node != -9999 quarters.neighbour_node[mask] = quarters.neighbour_node[mask] + 1 + quarters.neighbour_node[~mask] = 0 self.write_dataset(group, "neighbour_node", quarters.neighbour_node.T) def write_pumps(self, pumps):