From ff041e0b2842ca793d9d87d7b55619b98d12c430 Mon Sep 17 00:00:00 2001 From: spaulins-usgs Date: Wed, 11 Dec 2019 11:12:25 -0800 Subject: [PATCH 1/2] fix(boundnames): Fixed problem where boundnames did not get loaded for simple fast loads. Added test to catch problems similar to this in the future. --- autotest/t505_test.py | 10 +++++++--- flopy/mf6/data/mffileaccess.py | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/autotest/t505_test.py b/autotest/t505_test.py index 1933116e4b..1363d9a573 100644 --- a/autotest/t505_test.py +++ b/autotest/t505_test.py @@ -493,9 +493,10 @@ def test021_twri(): stress_period_data = [] drn_heads = [0.0, 0.0, 10.0, 20.0, 30.0, 50.0, 70.0, 90.0, 100.0] for col, head in zip(range(1, 10), drn_heads): - stress_period_data.append(((0, 7, col), head, 1.0)) + stress_period_data.append(((0, 7, col), head, 1.0, + 'name_{}'.format(col))) drn_package = ModflowGwfdrn(model, print_input=True, print_flows=True, - save_flows=True, maxbound=9, + save_flows=True, maxbound=9, boundnames=True, stress_period_data=stress_period_data) rch_package = ModflowGwfrcha(model, readasarrays=True, fixed_cell=True, recharge={0: 0.00000003}, @@ -503,7 +504,6 @@ def test021_twri(): aux = rch_package.aux.get_data() - stress_period_data = [] layers = [2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] rows = [4, 3, 5, 8, 8, 8, 8, 10, 10, 10, 10, 12, 12, 12, 12] @@ -527,9 +527,12 @@ def test021_twri(): model2 = sim2.get_model() ic2 = model2.get_package('ic') strt2 = ic2.strt.get_data() + drn2 = model2.get_package('drn') + drn_spd = drn2.stress_period_data.get_data() assert(strt2[0,0,0] == 0.0) assert(strt2[1,0,0] == 1.0) assert(strt2[2,0,0] == 2.0) + assert(drn_spd[0][1][3] == 'name_2') # compare output to expected results head_file = os.path.join(os.getcwd(), expected_head_file) @@ -742,6 +745,7 @@ def test005_advgw_tidal(): ((0, 6, 7), 'river_stage_2', 1008.0, 36.2, None), ((0, 6, 8), 'river_stage_2', 1009.0, 36.1), ((0, 6, 9), 'river_stage_2', 1010.0, 36.0)] + riv_period[0] = riv_period_array # riv time series ts_data = [(0.0, 40.0, 41.0), (1.0, 41.0, 41.5), (2.0, 43.0, 42.0), diff --git a/flopy/mf6/data/mffileaccess.py b/flopy/mf6/data/mffileaccess.py index 11e1bc422f..bd24d44c7d 100644 --- a/flopy/mf6/data/mffileaccess.py +++ b/flopy/mf6/data/mffileaccess.py @@ -1012,7 +1012,7 @@ def read_list_data_from_file(self, file_handle, storage, current_key, data_item, data_index, None, current_key, self._data_line, False)[0:2] - elif data_item.name == 'boundnames' and \ + elif data_item.name == 'boundname' and \ self._data_dimensions.package_dim.\ boundnames(): self._data_line += (convert_data( @@ -1473,7 +1473,8 @@ def _append_data_list(self, storage, data_item, arr_line, arr_line_len, if arr_line is None: data_converted = None if add_to_last_line: - self._last_line_info[-1].append([data_index, None, 0]) + self._last_line_info[-1].append([data_index, data_item.type, + 0]) else: if arr_line[data_index].lower() in \ self._data_dimensions.package_dim.get_tsnames(): From 50bd7274071199b10455d50506749a4b63ca8ecf Mon Sep 17 00:00:00 2001 From: spaulins-usgs Date: Thu, 12 Dec 2019 06:05:16 -0800 Subject: [PATCH 2/2] fix(line length) --- flopy/mf6/data/mffileaccess.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flopy/mf6/data/mffileaccess.py b/flopy/mf6/data/mffileaccess.py index bd24d44c7d..5025f6c671 100644 --- a/flopy/mf6/data/mffileaccess.py +++ b/flopy/mf6/data/mffileaccess.py @@ -1473,8 +1473,8 @@ def _append_data_list(self, storage, data_item, arr_line, arr_line_len, if arr_line is None: data_converted = None if add_to_last_line: - self._last_line_info[-1].append([data_index, data_item.type, - 0]) + self._last_line_info[-1].append([data_index, + data_item.type, 0]) else: if arr_line[data_index].lower() in \ self._data_dimensions.package_dim.get_tsnames():