From d3e11caa48114c290418c6a24fc00a3c27220835 Mon Sep 17 00:00:00 2001 From: mjreno Date: Fri, 14 Jun 2024 11:06:05 -0400 Subject: [PATCH 1/4] account for surf_rate_specified in evt spd binary header --- flopy/mf6/data/mffileaccess.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/flopy/mf6/data/mffileaccess.py b/flopy/mf6/data/mffileaccess.py index e64ed695d6..a2b9e331df 100644 --- a/flopy/mf6/data/mffileaccess.py +++ b/flopy/mf6/data/mffileaccess.py @@ -1130,15 +1130,22 @@ def _get_header(self): else: header.append((di_struct.name, np_flt_type)) ext_index += 1 - elif di_struct.name == "aux": - aux_var_names = ( - self._data_dimensions.package_dim.get_aux_variables() - ) - if aux_var_names is not None: - for aux_var_name in aux_var_names[0]: - if aux_var_name.lower() != "auxiliary": - header.append((aux_var_name, np_flt_type)) - ext_index += 1 + else: + if di_struct.name == "aux": + aux_var_names = ( + self._data_dimensions.package_dim.get_aux_variables() + ) + if aux_var_names is not None: + for aux_var_name in aux_var_names[0]: + if aux_var_name.lower() != "auxiliary": + header.append((aux_var_name, np_flt_type)) + ext_index += 1 + elif di_struct.name == "petm0": + for key in self._simulation_data.mfdata: + if 'surf_rate_specified' in key: + if self._simulation_data.mfdata[key].get_data(): + header.append((di_struct.name, np_flt_type)) + ext_index += 1 return header, int_cellid_indexes, ext_cellid_indexes def _get_cell_header(self, data_item, data_set, index): From 5da5a36f56a289cc4ac29b1c1e0811b1ec96f3ef Mon Sep 17 00:00:00 2001 From: mjreno Date: Fri, 14 Jun 2024 14:02:48 -0400 Subject: [PATCH 2/4] account for optional pxdp/petm fields in evt spd binary header --- flopy/mf6/data/mffileaccess.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/flopy/mf6/data/mffileaccess.py b/flopy/mf6/data/mffileaccess.py index a2b9e331df..9127d8d4ec 100644 --- a/flopy/mf6/data/mffileaccess.py +++ b/flopy/mf6/data/mffileaccess.py @@ -1131,6 +1131,7 @@ def _get_header(self): header.append((di_struct.name, np_flt_type)) ext_index += 1 else: + # optional tags if di_struct.name == "aux": aux_var_names = ( self._data_dimensions.package_dim.get_aux_variables() @@ -1142,10 +1143,30 @@ def _get_header(self): ext_index += 1 elif di_struct.name == "petm0": for key in self._simulation_data.mfdata: - if 'surf_rate_specified' in key: + if "surf_rate_specified" in key: if self._simulation_data.mfdata[key].get_data(): header.append((di_struct.name, np_flt_type)) ext_index += 1 + elif di_struct.name == "pxdp" or di_struct.name == "petm": + for key in self._simulation_data.mfdata: + if "nseg" in key: + if ( + self._simulation_data.mfdata[key].get_data() + > 1 + ): + for seg in range( + self._simulation_data.mfdata[ + key + ].get_data() + - 1 + ): + header.append( + ( + f"{di_struct.name}{seg+1}", + np_flt_type, + ) + ) + ext_index += 1 return header, int_cellid_indexes, ext_cellid_indexes def _get_cell_header(self, data_item, data_set, index): From a51e75dc3fdfdb309160714f5e458c0b4ebaf527 Mon Sep 17 00:00:00 2001 From: mjreno Date: Mon, 17 Jun 2024 19:46:04 -0400 Subject: [PATCH 3/4] consider surf_rate_specified when building the type list --- autotest/regression/test_mf6.py | 2 -- flopy/mf6/data/mfdatastorage.py | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/autotest/regression/test_mf6.py b/autotest/regression/test_mf6.py index e1c5850887..96709436d9 100644 --- a/autotest/regression/test_mf6.py +++ b/autotest/regression/test_mf6.py @@ -1528,7 +1528,6 @@ def test005_create_tests_advgw_tidal(function_tmpdir, example_data_path): 50.0, 0.0004, 10.0, - None, ) evt_package_test = ModflowGwfevt( model, @@ -1554,7 +1553,6 @@ def test005_create_tests_advgw_tidal(function_tmpdir, example_data_path): 0.5, 0.3, 0.1, - None, ) evt_package = ModflowGwfevt( model, diff --git a/flopy/mf6/data/mfdatastorage.py b/flopy/mf6/data/mfdatastorage.py index 8a57413538..ec2094fdc8 100644 --- a/flopy/mf6/data/mfdatastorage.py +++ b/flopy/mf6/data/mfdatastorage.py @@ -2710,7 +2710,13 @@ def build_type_list( self._append_type_lists( aux_var_name, data_type, False ) - + elif data_item.name == "petm0" and resolve_data_shape: + for key in self._simulation_data.mfdata: + if "surf_rate_specified" in key: + if self._simulation_data.mfdata[key].get_data(): + self._append_type_lists( + data_item.name, data_type, False + ) elif data_item.type == DatumType.record: # record within a record, recurse self.build_type_list(data_item, True, data) From a01aa3e2b403c0165db2d965528f3f2d3cb0da6b Mon Sep 17 00:00:00 2001 From: mjreno Date: Mon, 17 Jun 2024 20:05:06 -0400 Subject: [PATCH 4/4] update mf6_complex_model_example notebook --- .docs/Notebooks/mf6_complex_model_example.py | 1 - 1 file changed, 1 deletion(-) diff --git a/.docs/Notebooks/mf6_complex_model_example.py b/.docs/Notebooks/mf6_complex_model_example.py index f999b00d96..572626f87a 100644 --- a/.docs/Notebooks/mf6_complex_model_example.py +++ b/.docs/Notebooks/mf6_complex_model_example.py @@ -237,7 +237,6 @@ 0.5, 0.3, 0.1, - None, ) evt = flopy.mf6.ModflowGwfevt( gwf,