Skip to content

Commit

Permalink
Fix(print MFArray): Fixed printing of layered arrays - issue #1043 (#…
Browse files Browse the repository at this point in the history
…1045)

* Fix(print MFArray): Fixed printing of layered arrays - issue #1043

* refactor(Array string): Cleaned up formatting
  • Loading branch information
spaulins-usgs authored Jan 29, 2021
1 parent 7dc4326 commit b8322dd
Showing 1 changed file with 33 additions and 10 deletions.
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

0 comments on commit b8322dd

Please sign in to comment.