From afd918b48a54e64d36c351454e850e36c77fb561 Mon Sep 17 00:00:00 2001 From: Adam Cheng <52572642+adamchengtkc@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:24:43 +0000 Subject: [PATCH] logging --- warmth/build.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/warmth/build.py b/warmth/build.py index 1a3c15f..2201c45 100644 --- a/warmth/build.py +++ b/warmth/build.py @@ -735,15 +735,16 @@ def _create_nodes(self, all_sediments_grid: List[List[List]]): """ indexer = self.grid.indexing_arr - + valid = 0 + dropped = 0 for index in indexer: - if self.nodes[index[0]][index[1]] != False: node_sed: list[_sediment_layer_] = [] for sed_grid in all_sediments_grid: node_sed.append(sed_grid[index[0]][index[1]]) if all(node_sed) is False: self.nodes[index[0]][index[1]] = False + dropped += 1 logger.warning(f"dropping node {index}. One of the layer has no depth value") else: top = np.empty(0) @@ -774,6 +775,7 @@ def _create_nodes(self, all_sediments_grid: List[List[List]]): if checker is False: self.nodes[index[0]][index[1]] = False + dropped += 1 else: df = self._fix_nan_sed(df) n = single_node() @@ -782,8 +784,10 @@ def _create_nodes(self, all_sediments_grid: List[List[List]]): n.sediments_inputs=df n.indexer = index self.nodes[index[0]][index[1]] = n + valid += 1 else: pass + logger.info(f"Dropped {dropped} nodes. Remaining valid nodes = {valid}") return def _check_nan_sed(self,df:pd.DataFrame)-> bool: