Skip to content

Commit 73a4405

Browse files
authored
feat(mf6-lake): add helper function to create lake connections (#1163)
1 parent 2912b1d commit 73a4405

18 files changed

+4896
-4014
lines changed

.docs/code.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ Contents:
198198
./source/flopy.mf6.utils.output_util.rst
199199
./source/flopy.mf6.utils.postprocessing.rst
200200
./source/flopy.mf6.utils.reference.rst
201+
./source/flopy.mf6.utils.lakpak_utils.rst
201202

202203

203204
MODFLOW 6 Data

autotest/t016_test.py

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ def test_usg_disu_load():
4848
):
4949
if isinstance(value1, (flopy.utils.Util2d, flopy.utils.Util3d)):
5050
assert np.array_equal(value1.array, value2.array)
51-
elif isinstance(value1, list): #this is for the jagged _get_neighbours list
52-
assert np.all([np.all(v1 == v2) for v1,v2 in zip(value1,value2)])
51+
elif isinstance(
52+
value1, list
53+
): # this is for the jagged _get_neighbours list
54+
assert np.all([np.all(v1 == v2) for v1, v2 in zip(value1, value2)])
5355
elif not isinstance(value1, flopy.utils.reference.TemporalReference):
5456
assert value1 == value2
5557

@@ -136,8 +138,11 @@ def test_usg_model():
136138
success, buff = mf.run_model()
137139
assert success
138140

141+
139142
def test_usg_load_01B():
140-
print("testing 1-layer unstructured mfusg model loading: 01A_nestedgrid_nognc.nam")
143+
print(
144+
"testing 1-layer unstructured mfusg model loading: 01A_nestedgrid_nognc.nam"
145+
)
141146
pthusgtest = os.path.join(
142147
"..", "examples", "data", "mfusg_test", "01A_nestedgrid_nognc"
143148
)
@@ -162,11 +167,10 @@ def test_usg_load_01B():
162167
msg = "flopy failed on loading mfusg sms package"
163168
assert isinstance(m.sms, flopy.modflow.mfsms.ModflowSms), msg
164169

170+
165171
def test_usg_load_45usg():
166172
print("testing 3-layer unstructured mfusg model loading: 45usg.nam")
167-
pthusgtest = os.path.join(
168-
"..", "examples", "data", "mfusg_test", "45usg"
169-
)
173+
pthusgtest = os.path.join("..", "examples", "data", "mfusg_test", "45usg")
170174
fname = os.path.join(pthusgtest, "45usg.nam")
171175
assert os.path.isfile(fname), "nam file not found {}".format(fname)
172176

@@ -192,50 +196,66 @@ def test_usg_load_45usg():
192196
msg = "flopy failed on loading mfusg wel package"
193197
assert isinstance(m.wel, flopy.modflow.mfwel.ModflowWel), msg
194198

199+
195200
def test_usg_rch_evt_models01():
196201
# this test has RCH nrchop == 1, and EVT nevtop == 1
197-
print("testing unstructured mfusg RCH nrchop == 1, and EVT nevtop == 1: \
198-
usg_rch_evt.nam")
202+
print(
203+
"testing unstructured mfusg RCH nrchop == 1, and EVT nevtop == 1: \
204+
usg_rch_evt.nam"
205+
)
199206
model_ws = os.path.join(
200-
'..', 'examples', 'data', 'mfusg_test', 'rch_evt_tests')
201-
nam = 'usg_rch_evt.nam'
207+
"..", "examples", "data", "mfusg_test", "rch_evt_tests"
208+
)
209+
nam = "usg_rch_evt.nam"
202210
m = flopy.modflow.Modflow.load(
203-
nam, model_ws=model_ws, version='mfusg', exe_name=v)
211+
nam, model_ws=model_ws, version="mfusg", exe_name=v
212+
)
204213
m.model_ws = tpth
205214
m.write_input()
206215
if run:
207216
success, buff = m.run_model()
208217
assert success
209218

219+
210220
def test_usg_rch_evt_models02():
211221
# this test has RCH nrchop == 2, and EVT nevtop == 2
212-
print("testing unstructured mfusg RCH nrchop == 2, and EVT nevtop == 2: \
213-
usg_rch_evt_nrchop2.nam")
222+
print(
223+
"testing unstructured mfusg RCH nrchop == 2, and EVT nevtop == 2: \
224+
usg_rch_evt_nrchop2.nam"
225+
)
214226
model_ws = os.path.join(
215-
'..', 'examples', 'data', 'mfusg_test', 'rch_evt_tests')
216-
nam = 'usg_rch_evt_nrchop2.nam'
227+
"..", "examples", "data", "mfusg_test", "rch_evt_tests"
228+
)
229+
nam = "usg_rch_evt_nrchop2.nam"
217230
m = flopy.modflow.Modflow.load(
218-
nam, model_ws=model_ws, version='mfusg', exe_name=v)
231+
nam, model_ws=model_ws, version="mfusg", exe_name=v
232+
)
219233
m.model_ws = tpth
220234
m.write_input()
221235
if run:
222236
success, buff = m.run_model()
223-
assert success
237+
assert success
238+
224239

225240
def test_usg_rch_evt_models02a():
226241
# this test has RCH nrchop == 2, and EVT nevtop == 2
227-
print("testing unstructured mfusg RCH nrchop == 2, and EVT nevtop == 2,\
228-
but with fewer irch nodes: than in nodelay[0] usg_rch_evt_nrchop2.nam")
242+
print(
243+
"testing unstructured mfusg RCH nrchop == 2, and EVT nevtop == 2,\
244+
but with fewer irch nodes: than in nodelay[0] usg_rch_evt_nrchop2.nam"
245+
)
229246
model_ws = os.path.join(
230-
'..', 'examples', 'data', 'mfusg_test', 'rch_evt_tests')
231-
nam = 'usg_rch_evt_nrchop2a.nam'
247+
"..", "examples", "data", "mfusg_test", "rch_evt_tests"
248+
)
249+
nam = "usg_rch_evt_nrchop2a.nam"
232250
m = flopy.modflow.Modflow.load(
233-
nam, model_ws=model_ws, version='mfusg', exe_name=v)
251+
nam, model_ws=model_ws, version="mfusg", exe_name=v
252+
)
234253
m.model_ws = tpth
235254
m.write_input()
236255
if run:
237256
success, buff = m.run_model()
238-
assert success
257+
assert success
258+
239259

240260
if __name__ == "__main__":
241261
test_usg_disu_load()
@@ -246,4 +266,3 @@ def test_usg_rch_evt_models02a():
246266
test_usg_rch_evt_models01()
247267
test_usg_rch_evt_models02()
248268
test_usg_rch_evt_models02a()
249-

autotest/t029_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def test_faceflows():
241241
sim.run_simulation()
242242

243243
# get output
244-
gwf = sim.get_model("gwf_1")
244+
gwf = sim.get_model("freyberg")
245245
head = gwf.output.head().get_data()
246246
cbc = gwf.output.budget()
247247

@@ -305,7 +305,7 @@ def test_flowja_residuals():
305305
)
306306

307307
# get output
308-
gwf = sim.get_model("gwf_1")
308+
gwf = sim.get_model("freyberg")
309309
grb_file = os.path.join(tpth, "freyberg.dis.grb")
310310
cbc = gwf.output.budget()
311311

autotest/t039_test.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ def test_zonbud_readwrite_zbarray():
218218
"""
219219
x = np.random.randint(100, 200, size=(5, 150, 200))
220220
ZoneBudget.write_zone_file(os.path.join(outpth, "randint"), x)
221-
ZoneBudget.write_zone_file(os.path.join(outpth, "randint"), x, fmtin=35, iprn=2)
221+
ZoneBudget.write_zone_file(
222+
os.path.join(outpth, "randint"), x, fmtin=35, iprn=2
223+
)
222224
z = ZoneBudget.read_zone_file(os.path.join(outpth, "randint"))
223225
assert np.array_equal(x, z), "Input and output arrays do not match."
224226
return
@@ -397,7 +399,7 @@ def test_zonebudget_6():
397399
except ImportError:
398400
return
399401

400-
exe_name = 'mf6'
402+
exe_name = "mf6"
401403
zb_exe_name = "zbud6"
402404
cpth = os.path.join(".", "temp", "t039")
403405

@@ -407,8 +409,8 @@ def test_zonebudget_6():
407409
sim.write_simulation()
408410
success, _ = sim.run_simulation()
409411

410-
grb_file = os.path.join(cpth, 'test001e_UZF_3lay.dis.grb')
411-
cbc_file = os.path.join(cpth, 'test001e_UZF_3lay.cbc')
412+
grb_file = os.path.join(cpth, "test001e_UZF_3lay.dis.grb")
413+
cbc_file = os.path.join(cpth, "test001e_UZF_3lay.cbc")
412414

413415
ml = sim.get_model("gwf_1")
414416
idomain = np.ones(ml.modelgrid.shape, dtype=int)

autotest/t065_test_gridintersect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,5 +1360,6 @@ def test_rasters():
13601360

13611361
del rio
13621362

1363+
13631364
if __name__ == "__main__":
1364-
test_rasters()
1365+
test_rasters()

0 commit comments

Comments
 (0)