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 @@ -1117,21 +1117,22 @@ def _combine_masks(*args):
1117
1117
if is_scalar_or_string (args [0 ]):
1118
1118
raise ValueError ("First argument must be a sequence" )
1119
1119
nrecs = len (args [0 ])
1120
- margs = []
1121
- seqlist = [False ] * len (args )
1122
- masks = [] # list of masks that are True where bad
1120
+ margs = [] # Output args; some may be modified.
1121
+ seqlist = [False ] * len (args ) # Flags: True if output will be masked.
1122
+ masks = [] # List of masks.
1123
1123
for i , x in enumerate (args ):
1124
- if not isinstance (x , str ) and np .iterable (x ) and len (x ) == nrecs :
1125
- if isinstance (x , np .ma .MaskedArray ):
1126
- if x .ndim > 1 :
1127
- raise ValueError ("Masked arrays must be 1-D" )
1124
+ if is_scalar_or_string (x ) or len (x ) != nrecs :
1125
+ margs .append (x ) # Leave it unmodified.
1126
+ else :
1127
+ if isinstance (x , np .ma .MaskedArray ) and x .ndim > 1 :
1128
+ raise ValueError ("Masked arrays must be 1-D" )
1128
1129
x = np .asanyarray (x )
1129
1130
if x .ndim == 1 :
1130
1131
x = safe_masked_invalid (x )
1131
1132
seqlist [i ] = True
1132
1133
if np .ma .is_masked (x ):
1133
1134
masks .append (np .ma .getmaskarray (x ))
1134
- margs .append (x )
1135
+ margs .append (x ) # Possibly modified.
1135
1136
if len (masks ):
1136
1137
mask = np .logical_or .reduce (masks )
1137
1138
for i , x in enumerate (margs ):
You can’t perform that action at this time.
0 commit comments