Skip to content
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
15 changes: 8 additions & 7 deletions lib/iris/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,13 +1059,14 @@ def format_array(arr):
ffunc = str
max_line_len = 50

formatArray = np.core.arrayprint._formatArray
format_options = np.core.arrayprint._format_options
# Format the array with version 1.13 legacy behaviour
with np.printoptions(legacy="1.13"):
# Use this (private) routine for more control.
formatArray = np.core.arrayprint._formatArray
# N.B. the 'legacy' arg had different forms in different numpy versions
# -- fetch the required form from the internal options dict
legacy_key = np.core.arrayprint._format_options["legacy"]

options = np.get_printoptions()
options["legacy"] = "1.13"

with np.printoptions(**options):
result = formatArray(
arr,
ffunc,
Expand All @@ -1074,7 +1075,7 @@ def format_array(arr):
separator=", ",
edge_items=edge_items,
summary_insert=summary_insert,
legacy=format_options["legacy"],
legacy=legacy_key,
)

return result
Expand Down