Skip to content

Commit caacbc4

Browse files
mjrenomjreno
authored andcommitted
cleanup quickstart grid component test
1 parent db4ae1c commit caacbc4

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

test/test_mf6_codec.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,14 @@ def test_dumps_rcha():
313313
gwf = Gwf(dis=dis)
314314

315315
recharge = np.full((nrow, ncol), FILL_DNODATA, dtype=float)
316+
irch = np.full((nrow, ncol), 1, dtype=int)
317+
irch[0, 0] = 2
318+
irch[9, 9] = 2
316319
recharge[0, 0] = 1.0
317320
recharge[9, 9] = 0.0
318321
rch = Rcha(
319322
parent=gwf,
323+
irch=np.expand_dims(irch.ravel(), axis=0),
320324
recharge=np.expand_dims(recharge.ravel(), axis=0),
321325
save_flows=True,
322326
print_input=True,
@@ -333,10 +337,13 @@ def test_dumps_rcha():
333337
period_section = dumped.split("BEGIN PERIOD 1")[1].split("END PERIOD 1")[0].strip()
334338
lines = [line.strip() for line in period_section.split("\n") if line.strip()]
335339

336-
assert len(lines) == 3
340+
assert len(lines) == 6
337341
assert "READASARRAYS" in dumped
338-
dump_data = [float(x) for x in lines[2].split()]
339-
dump_recharge = np.array(dump_data)
342+
dump_irch = [int(x) for x in lines[2].split()]
343+
dump_lidx = np.array(dump_irch)
344+
assert np.allclose(irch, dump_lidx.reshape(nrow, ncol))
345+
dump_rch = [float(x) for x in lines[5].split()]
346+
dump_recharge = np.array(dump_rch)
340347
assert np.allclose(recharge, dump_recharge.reshape(nrow, ncol))
341348

342349
loaded = loads(dumped)

test/test_mf6_component.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -435,15 +435,15 @@ def test_quickstart_grid(function_tmpdir):
435435
)
436436
npf = Npf(parent=gwf, icelltype=0, k=1.0)
437437

438-
# chd grid based input, step 1 data head array
439-
head = np.full((nlay, nrow, ncol), FILL_DNODATA, dtype=float)
440-
head[0, 0, 0] = 1.0
441-
head[0, 9, 9] = 0.0
442-
# TODO: support dict style input keyed on SP with separate grid arrays
443-
chd = Chdg(parent=gwf, head=np.expand_dims(head.ravel(), axis=0))
444-
# headnone = np.full((nlay, nrow, ncol), FILL_DNODATA, dtype=float)
445-
# ts_head = np.stack((head.ravel(), headnone.ravel()), axis=0)
446-
# chd = Chdg(parent=gwf, head=ts_head)
438+
# Chdg
439+
GRID_NODATA = np.full((nlay, nrow, ncol), FILL_DNODATA, dtype=float)
440+
head = np.repeat(np.expand_dims(GRID_NODATA, axis=0), repeats=1, axis=0)
441+
head[0, 0, 0, 0] = 1.0
442+
head[0, 0, 9, 9] = 0.0
443+
chd = Chdg(
444+
parent=gwf,
445+
head=head.reshape(1, -1),
446+
)
447447

448448
sim.write()
449449
sim.run()

0 commit comments

Comments
 (0)