Skip to content

Commit 3dcb153

Browse files
committed
make schism_mesh read comment in hgrid if it exists
1 parent 4ba9b63 commit 3dcb153

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

schimpy/schism_mesh.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,12 @@ def read_boundaries(self, f):
899899
if len(tkns) < 1:
900900
self._logger.error("Error reading: %s", line)
901901
raise ValueError("Boundary block is corrupt")
902+
## if comment exists, additional handling here
903+
## to add as bounary comment
904+
comment = None
905+
if "!" in line:
906+
comment_index = line.index("!")
907+
comment = line[comment_index:].strip()
902908
n_nodes = int(tkns[0])
903909
nodes = []
904910
for j in range(n_nodes):
@@ -909,7 +915,7 @@ def read_boundaries(self, f):
909915
raise ValueError("Boundary block is corrupt")
910916
node = int(tkns[0]) - 1 # Zero based
911917
nodes.append(node)
912-
self._mesh.add_boundary(nodes, BoundaryType.OPEN)
918+
self._mesh.add_boundary(nodes, BoundaryType.OPEN,comment)
913919

914920
line = f.readline()
915921
tkns = line.split()

0 commit comments

Comments
 (0)