@@ -2709,8 +2709,11 @@ class MaskedArray(ndarray):
2709
2709
_defaultmask = nomask
2710
2710
_defaulthardmask = False
2711
2711
_baseclass = ndarray
2712
- # Maximum number of elements per axis used when printing an array.
2712
+
2713
+ # Maximum number of elements per axis used when printing an array. The
2714
+ # 1d case is handled separately because we need more values in this case.
2713
2715
_print_width = 100
2716
+ _print_width_1d = 1500
2714
2717
2715
2718
def __new__ (cls , data = None , mask = nomask , dtype = None , copy = False ,
2716
2719
subok = True , ndmin = 0 , fill_value = None , keep_mask = True ,
@@ -3796,9 +3799,11 @@ def __str__(self):
3796
3799
mask = m
3797
3800
# For big arrays, to avoid a costly conversion to the
3798
3801
# object dtype, extract the corners before the conversion.
3802
+ print_width = (self ._print_width if self .ndim > 1
3803
+ else self ._print_width_1d )
3799
3804
for axis in range (self .ndim ):
3800
- if data .shape [axis ] > self . _print_width :
3801
- ind = self . _print_width // 2
3805
+ if data .shape [axis ] > print_width :
3806
+ ind = print_width // 2
3802
3807
arr = np .split (data , (ind , - ind ), axis = axis )
3803
3808
data = np .concatenate ((arr [0 ], arr [2 ]), axis = axis )
3804
3809
arr = np .split (mask , (ind , - ind ), axis = axis )
0 commit comments