From 90e12fb1228dafb3d7a1e0978262214e1ffcd555 Mon Sep 17 00:00:00 2001 From: jdhughes-usgs Date: Fri, 22 Nov 2019 20:38:40 -0600 Subject: [PATCH] fix(mnw2): fix issues causing random failures on python 3.5 --- autotest/t027_test.py | 8 ++++---- flopy/modflow/mfmnw2.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/autotest/t027_test.py b/autotest/t027_test.py index 7af3d8ac69..52bf5ef930 100644 --- a/autotest/t027_test.py +++ b/autotest/t027_test.py @@ -157,11 +157,10 @@ def test_make_package(): m4.write_input() # make the package from the objects + # reuse second per pumping for last stress period mnw2fromobj = flopy.modflow.ModflowMnw2(model=m4, mnwmax=2, mnw=mnw2_4.mnw, - itmp=[2, 2, -1], - # reuse second per pumping for last stress period - ) + itmp=[2, 2, -1]) # verify that the two input methods produce the same results assert np.array_equal(mnw2_4.stress_period_data[1], mnw2fromobj.stress_period_data[1]) @@ -318,8 +317,9 @@ def test_blank_lines(): wellids = ['eb-33', 'eb-35', 'eb-36'] rates = [np.float32(-11229.2), np.float32(-534.72), np.float32(-534.72)] + wellids2 = sorted(list(mnw2.mnw.keys())) emsg = 'incorrect keys returned from load mnw2' - assert list(mnw2.mnw.keys()) == wellids, emsg + assert wellids2 == wellids, emsg spd = mnw2.stress_period_data[0] diff --git a/flopy/modflow/mfmnw2.py b/flopy/modflow/mfmnw2.py index 21a33d9753..3c74e52cb6 100644 --- a/flopy/modflow/mfmnw2.py +++ b/flopy/modflow/mfmnw2.py @@ -1455,7 +1455,8 @@ def make_node_data(self, mnwobjs): node_data = ModflowMnw2.get_empty_node_data(len(mnwobj_node_data)) for ix, node in enumerate(mnwobj_node_data): - node_data[ix] = node + for jx, name in enumerate(node_data.dtype.names): + node_data[name][ix] = node[jx] self.node_data = node_data