File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 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):
10801080 if is_scalar_or_string (args [0 ]):
10811081 raise ValueError ("First argument must be a sequence" )
10821082 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.
10861086 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" )
10911092 x = np .asanyarray (x )
10921093 if x .ndim == 1 :
10931094 x = safe_masked_invalid (x )
10941095 seqlist [i ] = True
10951096 if np .ma .is_masked (x ):
10961097 masks .append (np .ma .getmaskarray (x ))
1097- margs .append (x )
1098+ margs .append (x ) # Possibly modified.
10981099 if len (masks ):
10991100 mask = np .logical_or .reduce (masks )
11001101 for i , x in enumerate (margs ):
You can’t perform that action at this time.
0 commit comments