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(print MFArray): Fixed printing of layered arrays - issue #1043 #1045

Merged
merged 2 commits into from
Jan 29, 2021
Merged
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
43 changes: 33 additions & 10 deletions flopy/mf6/data/mfdatastorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,29 +450,52 @@ def get_data_str(self, formal):
data_str = ""
# Assemble strings for internal array data
for index, storage in enumerate(self.layer_storage.elements()):
if self.layered:
layer_str = "Layer_{}".format(str(index + 1))
else:
layer_str = ""
if storage.data_storage_type == DataStorageType.internal_array:
if storage.internal_data is not None:
header = self._get_layer_header_str(index)
if formal:
if self.layered:
data_str = "{}Layer_{}{{{}}}" "\n({})\n".format(
data_str, index + 1, header, repr(storage)
data_str = "{}{}{{{}}}" "\n({})\n".format(
data_str,
layer_str,
header,
repr(self.get_data((index,))),
)
else:
data_str = "{}{{{}}}\n({})\n".format(
data_str, header, repr(storage)
data_str = "{}{}{{{}}}\n({})\n".format(
data_str,
layer_str,
header,
repr(self.get_data((index,))),
)
else:
data_str = "{}{{{}}}\n({})\n".format(
data_str, header, str(storage)
data_str = "{}{}{{{}}}\n({})\n".format(
data_str,
layer_str,
header,
str(self.get_data((index,))),
)
elif (
storage.data_storage_type == DataStorageType.internal_constant
):
if storage.data_const_value is not None:
data_str = "{}{{{}}}" "\n".format(
data_str, self._get_layer_header_str(index)
)
if formal:
if storage.data_const_value is not None:
data_str = "{}{}{{{}}}" "\n".format(
data_str,
layer_str,
self._get_layer_header_str(index),
)
else:
if storage.data_const_value is not None:
data_str = "{}{}{{{}}}" "\n".format(
data_str,
layer_str,
self._get_layer_header_str(index),
)
return data_str

def _get_layer_header_str(self, layer):
Expand Down