Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(binaryheader): account for optional fields in evt spd binary header #2234

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .docs/Notebooks/mf6_complex_model_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@
0.5,
0.3,
0.1,
None,
)
evt = flopy.mf6.ModflowGwfevt(
gwf,
Expand Down
2 changes: 0 additions & 2 deletions autotest/regression/test_mf6.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
8 changes: 7 additions & 1 deletion flopy/mf6/data/mfdatastorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
46 changes: 37 additions & 9 deletions flopy/mf6/data/mffileaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,15 +1130,43 @@ 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:
# optional tags
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
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):
Expand Down
Loading