MCPcopy
hub / github.com/pydata/xarray / short_array_repr

Function short_array_repr

xarray/core/formatting.py:670–694  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

668
669
670def short_array_repr(array):
671 from xarray.core.common import AbstractArray
672
673 if isinstance(array, AbstractArray):
674 array = array.data
675 if isinstance(array, pd.api.extensions.ExtensionArray):
676 return repr(array)
677 array = to_duck_array(array)
678
679 # default to lower precision so a full (abbreviated) line can fit on
680 # one line with the default display_width
681 options = {
682 "precision": 6,
683 "linewidth": OPTIONS["display_width"],
684 "threshold": OPTIONS["display_values_threshold"],
685 }
686 if array.ndim < 3:
687 edgeitems = 3
688 elif array.ndim == 3:
689 edgeitems = 2
690 else:
691 edgeitems = 1
692 options["edgeitems"] = edgeitems
693 with set_numpy_options(**options):
694 return repr(array)
695
696
697def short_data_repr(array):

Callers 3

apply_variable_ufuncFunction · 0.90
short_data_reprFunction · 0.85
diff_array_reprFunction · 0.85

Calls 2

to_duck_arrayFunction · 0.90
set_numpy_optionsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…