File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -1080,21 +1080,22 @@ def _combine_masks(*args):
1080
1080
if is_scalar_or_string (args [0 ]):
1081
1081
raise ValueError ("First argument must be a sequence" )
1082
1082
nrecs = len (args [0 ])
1083
- margs = []
1084
- seqlist = [False ] * len (args )
1085
- masks = [] # list of masks that are True where bad
1083
+ margs = [] # Output args; some may be modified.
1084
+ seqlist = [False ] * len (args ) # Flags: True if output will be masked.
1085
+ masks = [] # List of masks.
1086
1086
for i , x in enumerate (args ):
1087
- if not isinstance (x , str ) and np .iterable (x ) and len (x ) == nrecs :
1088
- if isinstance (x , np .ma .MaskedArray ):
1089
- if x .ndim > 1 :
1090
- raise ValueError ("Masked arrays must be 1-D" )
1087
+ if is_scalar_or_string (x ) or len (x ) != nrecs :
1088
+ margs .append (x ) # Leave it unmodified.
1089
+ else :
1090
+ if isinstance (x , np .ma .MaskedArray ) and x .ndim > 1 :
1091
+ raise ValueError ("Masked arrays must be 1-D" )
1091
1092
x = np .asanyarray (x )
1092
1093
if x .ndim == 1 :
1093
1094
x = safe_masked_invalid (x )
1094
1095
seqlist [i ] = True
1095
1096
if np .ma .is_masked (x ):
1096
1097
masks .append (np .ma .getmaskarray (x ))
1097
- margs .append (x )
1098
+ margs .append (x ) # Possibly modified.
1098
1099
if len (masks ):
1099
1100
mask = np .logical_or .reduce (masks )
1100
1101
for i , x in enumerate (margs ):
You can’t perform that action at this time.
0 commit comments