Skip to content

Commit

Permalink
add gwf disu test
Browse files Browse the repository at this point in the history
  • Loading branch information
mjreno authored and mjreno committed Nov 18, 2024
1 parent 3f6b84c commit 649a8ce
Show file tree
Hide file tree
Showing 41 changed files with 4,906 additions and 139 deletions.
16 changes: 10 additions & 6 deletions flopy4/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,18 @@ def load(cls, f, cwd, shape, header=True, **kwargs):
nlay = params.get("dimensions").get("nlay")
nrow = params.get("dimensions").get("nrow")
ncol = params.get("dimensions").get("ncol")
shape = (nlay, nrow, ncol)
elif "disv" in mempath.split("/"):
nlay = params.get("dimensions").get("nlay")
ncpl = params.get("dimensions").get("ncpl")
shape = (nlay, ncpl)
elif "disu" in mempath.split("/"):
nodes = params.get("dimensions").get("nodes")
if nrow and ncol:
shape = (nlay, nrow, ncol)
elif ncpl:
shape = (nlay, ncpl)
elif nodes:
nja = params.get("dimensions").get("nja")
if "nodes" in shape:
shape = nodes
elif "nja" in shape:
shape = nja
if layered:
nlay = shape[0]
lshp = shape[1:]
Expand Down Expand Up @@ -554,7 +558,7 @@ def read_array(f, dtype):
pos = f.tell()
line = f.readline()
line = line_strip(line)
if not re.match("^[0-9. ]+$", line):
if not re.match("^[-0-9. ]+$", line):
f.seek(pos, 0)
break
astr.append(line)
Expand Down
2 changes: 1 addition & 1 deletion flopy4/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def load(cls, f, **kwargs):
line = f.readline()
if line == "":
raise ValueError("Early EOF, aborting")
if line == "\n":
if line == "\n" or line.lstrip().startswith("#"):
continue
words = strip(line).lower().split()
if period:
Expand Down
4 changes: 3 additions & 1 deletion flopy4/compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ def load(cls, f, **kwargs) -> "MFList":
while True:
pos = f.tell()
line = f.readline()
if line.lower().startswith("end"):
if line == "\n" or line.lstrip().startswith("#"):
continue
elif line.lower().startswith("end"):
f.seek(pos)
break
else:
Expand Down
Loading

0 comments on commit 649a8ce

Please sign in to comment.