Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions autotest/test_usg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
MfUsgDisU,
MfUsgLpf,
MfUsgOc,
MfUsgRch,
MfUsgSms,
MfUsgWel,
)
Expand Down Expand Up @@ -464,6 +465,37 @@ def test_free_format_npl(function_tmpdir, freyberg_usg_model_path):
continue


def test_mfusgrch_selev_iznrch(function_tmpdir):
Comment thread
wpbonelli marked this conversation as resolved.
Outdated
"""Repro #2763"""
m = MfUsg(
version="mfusg",
structured=True,
model_ws=function_tmpdir,
modelname="test_rch",
)
ModflowDis(m, nlay=1, nrow=3, ncol=3, nper=2)

rech = 1e-3
selev_data = np.full((3, 3), 5.0, dtype=np.float32)
iznrch_data = np.full((3, 3), 2, dtype=np.int32)

rch = MfUsgRch(
m,
nrchop=3,
rech=rech,
seepelev=1,
selev=selev_data,
iznrch=iznrch_data,
)

assert np.allclose(rch.selev[0].array, selev_data)
assert np.array_equal(rch.iznrch[0].array, iznrch_data)

rch.write_file(check=False)
content = (function_tmpdir / "test_rch.rch").read_text()
assert " # Stress period 1" in content


def test_free_format_npl_constructor():
"""Test that free_format_npl can be set via constructor kwarg."""
m = MfUsg(free_format_npl=10)
Expand Down
10 changes: 5 additions & 5 deletions flopy/mfusg/mfusgoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,11 +955,11 @@ def load(cls, f, model, nper=None, nstp=None, nlay=None, ext_unit_dict=None):
if kwargs["atsa"]:
line = f.readline()
lnlst = line.strip().split()
lines.append("DELTAT {float(lnlst[0]):11.4e}")
lines.append("TMINAT {float(lnlst[1]):11.4e}")
lines.append("TMAXAT {float(lnlst[2]):11.4e}")
lines.append("TADJAT {float(lnlst[3]):11.4e}")
lines.append("TCUTAT {float(lnlst[4]):11.4e}")
lines.append(f"DELTAT {float(lnlst[0]):11.4e}")
lines.append(f"TMINAT {float(lnlst[1]):11.4e}")
lines.append(f"TMAXAT {float(lnlst[2]):11.4e}")
lines.append(f"TADJAT {float(lnlst[3]):11.4e}")
lines.append(f"TCUTAT {float(lnlst[4]):11.4e}")

line = f.readline()
lnlst = line.strip().split()
Expand Down
8 changes: 4 additions & 4 deletions flopy/mfusg/mfusgrch.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ def __init__(
if selev is not None:
selev_u2d_shape = get_pak_vals_shape(model, selev)
self.selev = Transient2d(
model, selev_u2d_shape, np.float32, rech, name="rech_selev"
model, selev_u2d_shape, np.float32, selev, name="rech_selev"
)

self.iznrch = None
if iznrch is not None:
iznrch_u2d_shape = get_pak_vals_shape(model, iznrch)
self.iznrch = Transient2d(
model, iznrch_u2d_shape, np.int32, rech, name="rech_izn"
model, iznrch_u2d_shape, np.int32, iznrch, name="rech_izn"
)

self.rchconc = None
Expand Down Expand Up @@ -173,7 +173,7 @@ def write_file(self, check=True, f=None):
if self.iconc:
f_rch.write(" CONC")
if self.mxrtzones:
f_rch.write(f" RTS {self.mxrtzones:4.0d}")
f_rch.write(f" RTS {self.mxrtzones:4d}")
f_rch.write("\n")

mcomp = self.parent.mcomp
Expand Down Expand Up @@ -219,7 +219,7 @@ def write_file(self, check=True, f=None):
f_rch.write(" INSELEV 1")
if self.rchconc is not None:
f_rch.write(" INCONC 1")
f_rch.write("# Stress period {kper + 1}\n")
f_rch.write(f" # Stress period {kper + 1}\n")

if inrech >= 0:
f_rch.write(file_entry_rech)
Expand Down
Loading