Skip to content

Commit

Permalink
Use flopy's set_data() method again, assuming version 3.3.6 or later (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews authored Sep 27, 2023
1 parent 6733975 commit 48dc205
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ doc = [
"sphinx-issues",
]
extra = [
"flopy",
"flopy >=3.3.6",
"matplotlib",
"netcdf4",
]
Expand Down
17 changes: 2 additions & 15 deletions swn/modflow/_swnmf6.py
Original file line number Diff line number Diff line change
Expand Up @@ -1351,10 +1351,7 @@ def _check_reach_v_laybot(r, botms, buffer=1.0, rbed_elev=None):
"%s cells less than %s", thincells.sum(), minthick)
laythick[thincells] = minthick
layerbots[k + 1] = layerbots[k] - laythick
# flopy messing with external file names so apply in wrapper
# TODO remove line if flopy is patched (https://github.com/modflowpy/flopy/issues/1534)
_flopy_set3darray(self.model.dis.botm, layerbots)
# self.model.dis.botm.set_data(layerbots)
self.model.dis.botm.set_data(layerbots)

def _reachbyreach_elevs(
self, minslope=1e-4, minincise=0.2, minthick=0.5, fix_dis=True,
Expand Down Expand Up @@ -1644,10 +1641,7 @@ def _check_reach_v_laybot(r, botms, buffer=1.0, rbed_elev=None):
"%s cells less than %s", thincells.sum(), minthick)
laythick[thincells] = minthick
layerbots[k + 1] = layerbots[k] - laythick
# flopy messing with external file names so apply in wrapper
# TODO remove line if flopy is patched (https://github.com/modflowpy/flopy/issues/1534)
_flopy_set3darray(self.model.dis.botm, layerbots)
# self.model.dis.botm.set_data(layerbots)
self.model.dis.botm.set_data(layerbots)


def _to_rno_elevs(
Expand Down Expand Up @@ -1960,13 +1954,6 @@ def go_downstream(rno):
return con1[:idx1] + list(reversed(con2[:idx2]))


def _flopy_set3darray(flopyobj, array3d):
data = [{"filename": flopyobj[k].fname, "data":ar}
if flopyobj[k].fname else {"data": ar}
for k, ar in enumerate(array3d)]
flopyobj.set_data(data)


def get_flopy_mf6_package(name: str):
"""Returns a flopy.mf6 package.
Expand Down

0 comments on commit 48dc205

Please sign in to comment.