diff --git a/autotest/t505_test.py b/autotest/t505_test.py index 1363d9a57..104f4fcfd 100644 --- a/autotest/t505_test.py +++ b/autotest/t505_test.py @@ -929,6 +929,28 @@ def test005_advgw_tidal(): tdis_file = os.path.join(run_folder, 'all_files_same_name.tdis') assert os.path.exists(tdis_file) + # load simulation + sim_load = MFSimulation.load(sim.name, 'mf6', exe_name, + sim.simulation_data.mfpath.get_sim_path(), + verbosity_level=0) + model = sim_load.get_model() + # confirm ghb obs data has two blocks with correct file names + ghb = model.get_package('ghb') + obs = ghb.obs + obs_data = obs.continuous.get_data() + found_flows = False + found_obs = False + for key, value in obs_data.items(): + if key.lower() == 'ghb_flows.csv': + # there should be only one + assert not found_flows + found_flows = True + if key.lower() == 'ghb_obs.csv': + # there should be only one + assert not found_obs + found_obs = True + assert found_flows and found_obs + # clean up sim.delete_output_files() diff --git a/flopy/mf6/mfpackage.py b/flopy/mf6/mfpackage.py index 6cccd08cd..c357e8286 100644 --- a/flopy/mf6/mfpackage.py +++ b/flopy/mf6/mfpackage.py @@ -93,17 +93,28 @@ def build_header_variables(self, simulation_data, block_header_structure, self.data_items.append(new_data) def is_same_header(self, block_header): - if len(self.data_items) == 0 or \ - len(block_header.variable_strings) == 0: + if len(self.variable_strings) > 0: + if len(self.variable_strings) != \ + len(block_header.variable_strings): + return False + else: + for sitem, oitem in zip(self.variable_strings, + block_header.variable_strings): + if sitem != oitem: + return False return True - typ_obj = self.data_items[0].structure.data_item_structures[0].type_obj - if typ_obj == int or typ_obj == float: - if self.variable_strings[0] == block_header.variable_strings[0]: - return True + elif len(self.data_items) > 0 and \ + len(block_header.variable_strings) > 0: + typ_obj = self.data_items[0].structure.data_item_structures[0].\ + type_obj + if typ_obj == int or typ_obj == float: + return bool(self.variable_strings[0] == \ + block_header.variable_strings[0]) else: - return False - else: + return True + elif len(self.data_items) == len(block_header.variable_strings): return True + return False def get_comment(self): if self.simulation_data is None: diff --git a/requirements.travis.txt b/requirements.travis.txt index 63f8a39ef..fc0e0fc16 100644 --- a/requirements.travis.txt +++ b/requirements.travis.txt @@ -1,7 +1,6 @@ appdirs matplotlib -netcdf4 ; python_version != '3.8' -netcdf4 != 1.5.3 ; python_version == '3.8' +netcdf4 != 1.5.3 fiona ; python_version < '3.8' descartes pyproj