Skip to content

Commit

Permalink
add gwf disv 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 649a8ce commit df36c20
Show file tree
Hide file tree
Showing 32 changed files with 4,683 additions and 682 deletions.
8 changes: 7 additions & 1 deletion flopy4/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,13 @@ def load(cls, f, cwd, shape, header=True, **kwargs):
elif "disv" in mempath.split("/"):
nlay = params.get("dimensions").get("nlay")
ncpl = params.get("dimensions").get("ncpl")
shape = (nlay, ncpl)
nvert = params.get("dimensions").get("nvert")
if shape == "(ncpl)":
shape = ncpl
elif shape == "(ncpl, nlay)":
shape = (nlay, ncpl)
elif shape == "(nvert)":
shape = nvert
elif "disu" in mempath.split("/"):
nodes = params.get("dimensions").get("nodes")
nja = params.get("dimensions").get("nja")
Expand Down
25 changes: 18 additions & 7 deletions flopy4/compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ def load(cls, f, **kwargs) -> "MFList":
kwargs.pop("mname", None)
kwargs.pop("shape", None) # e.g. maxbound

jidx = -1
param_lists = []
param_cols = []
param_types = []
Expand All @@ -353,18 +354,26 @@ def load(cls, f, **kwargs) -> "MFList":
# "boundames and auxvars not yet supported in period blocks"
# )
pcols = 0
if params[k].shape is None or params[k].shape == "":
if (
params[k].shape is None
or params[k].shape == ""
or params[k].shape == "(:)"
):
pcols = 1
elif params[k].shape == "(ncelldim)":
if model_shape:
pcols = len(model_shape)
else:
raise ValueError("model_shape not set")
assert model_shape
pcols = len(model_shape)
elif params[k].shape == "(ncvert)":
# param_cols will be updated each line
jidx = len(param_cols) - 1
else:
pcols = len(params[k].shape.split(","))
raise ValueError(
"MFList param {params[k].name} has "
"unsupported shape {params[k].shape}"
)
param_cols.append(pcols)
param_lists.append(list())
param_types.append(params[k].type)
param_lists.append(list())

if list(params.items())[-1][1].shape == "(:)":
maxsplit = sum(param_cols) - 1
Expand All @@ -381,6 +390,8 @@ def load(cls, f, **kwargs) -> "MFList":
break
else:
tokens = strip(line).split(maxsplit=maxsplit)
if jidx >= 0:
param_cols[jidx + 1] = int(tokens[jidx])
assert len(tokens) == sum(param_cols)
icol = 0
for i in range(len(param_types)):
Expand Down
Loading

0 comments on commit df36c20

Please sign in to comment.