Skip to content

Commit df36c20

Browse files
mjrenomjreno
authored andcommitted
add gwf disv test
1 parent 649a8ce commit df36c20

32 files changed

+4683
-682
lines changed

flopy4/array.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,13 @@ def load(cls, f, cwd, shape, header=True, **kwargs):
460460
elif "disv" in mempath.split("/"):
461461
nlay = params.get("dimensions").get("nlay")
462462
ncpl = params.get("dimensions").get("ncpl")
463-
shape = (nlay, ncpl)
463+
nvert = params.get("dimensions").get("nvert")
464+
if shape == "(ncpl)":
465+
shape = ncpl
466+
elif shape == "(ncpl, nlay)":
467+
shape = (nlay, ncpl)
468+
elif shape == "(nvert)":
469+
shape = nvert
464470
elif "disu" in mempath.split("/"):
465471
nodes = params.get("dimensions").get("nodes")
466472
nja = params.get("dimensions").get("nja")

flopy4/compound.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ def load(cls, f, **kwargs) -> "MFList":
343343
kwargs.pop("mname", None)
344344
kwargs.pop("shape", None) # e.g. maxbound
345345

346+
jidx = -1
346347
param_lists = []
347348
param_cols = []
348349
param_types = []
@@ -353,18 +354,26 @@ def load(cls, f, **kwargs) -> "MFList":
353354
# "boundames and auxvars not yet supported in period blocks"
354355
# )
355356
pcols = 0
356-
if params[k].shape is None or params[k].shape == "":
357+
if (
358+
params[k].shape is None
359+
or params[k].shape == ""
360+
or params[k].shape == "(:)"
361+
):
357362
pcols = 1
358363
elif params[k].shape == "(ncelldim)":
359-
if model_shape:
360-
pcols = len(model_shape)
361-
else:
362-
raise ValueError("model_shape not set")
364+
assert model_shape
365+
pcols = len(model_shape)
366+
elif params[k].shape == "(ncvert)":
367+
# param_cols will be updated each line
368+
jidx = len(param_cols) - 1
363369
else:
364-
pcols = len(params[k].shape.split(","))
370+
raise ValueError(
371+
"MFList param {params[k].name} has "
372+
"unsupported shape {params[k].shape}"
373+
)
365374
param_cols.append(pcols)
366-
param_lists.append(list())
367375
param_types.append(params[k].type)
376+
param_lists.append(list())
368377

369378
if list(params.items())[-1][1].shape == "(:)":
370379
maxsplit = sum(param_cols) - 1
@@ -381,6 +390,8 @@ def load(cls, f, **kwargs) -> "MFList":
381390
break
382391
else:
383392
tokens = strip(line).split(maxsplit=maxsplit)
393+
if jidx >= 0:
394+
param_cols[jidx + 1] = int(tokens[jidx])
384395
assert len(tokens) == sum(param_cols)
385396
icol = 0
386397
for i in range(len(param_types)):

0 commit comments

Comments
 (0)