Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchengtkc committed Dec 11, 2024
1 parent c8873ac commit afd918b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions warmth/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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:
Expand Down

0 comments on commit afd918b

Please sign in to comment.