Skip to content

Commit

Permalink
minor tweaks to require idomain the same for all layers
Browse files Browse the repository at this point in the history
  • Loading branch information
langevin-usgs committed Jul 23, 2024
1 parent 4a0c65d commit 0cb3f71
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 7 additions & 5 deletions autotest/test_lgrutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def test_lgrutil3():
for k in range(nlayp):
botmp[k] = -(k + 1) * dz
idomainp = np.ones((nlayp, nrowp, ncolp), dtype=int)
idomainp[0, nrowp // 2, ncolp // 2] = 0
idomainp[:, nrowp // 2, ncolp // 2] = 0
ncpp = 3
ncppl = nlayp * [1]
lgr = Lgr(
Expand Down Expand Up @@ -219,9 +219,11 @@ def test_lgrutil3():
assert lgrtodisv.iverts[4] == [6, 7, 11, 10, 27, 23]
assert lgrtodisv.iverts[6] == [9, 29, 30, 10, 14, 13]

assert gridprops["top"].min() == gridprops["top"].max() == dz
assert np.allclose(gridprops["top"], dz * np.ones((17,)))

assert gridprops["botm"].shape == (3, 17)
assert gridprops["botm"][0].min() == gridprops["botm"][0].min() == -dz
assert gridprops["botm"][1].min() == gridprops["botm"][1].min() == -2 * dz
assert gridprops["botm"][2].min() == gridprops["botm"][2].min() == -3 * dz
b = np.empty((3, 17))
b[0] = -dz
b[1] = -2 * dz
b[2] = -3 * dz
assert np.allclose(gridprops["botm"], b)
4 changes: 4 additions & 0 deletions flopy/utils/lgrutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,10 @@ def get_disv_gridprops(self):
assert (
self.lgr.nlayp == self.lgr.nlay
), "Exporting disv grid properties requires parent and child models to have the same number of layers."
for k in range(self.lgr.nlayp - 1):
assert np.allclose(
self.lgr.idomain[k], self.lgr.idomain[k + 1]
), "Exporting disv grid properties requires parent idomain is same for all layers."

# get information and build gridprops
xcyc = self.get_xcyc()
Expand Down

0 comments on commit 0cb3f71

Please sign in to comment.