File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1117,21 +1117,22 @@ def _combine_masks(*args):
11171117 if is_scalar_or_string (args [0 ]):
11181118 raise ValueError ("First argument must be a sequence" )
11191119 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.
11231123 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" )
11281129 x = np .asanyarray (x )
11291130 if x .ndim == 1 :
11301131 x = safe_masked_invalid (x )
11311132 seqlist [i ] = True
11321133 if np .ma .is_masked (x ):
11331134 masks .append (np .ma .getmaskarray (x ))
1134- margs .append (x )
1135+ margs .append (x ) # Possibly modified.
11351136 if len (masks ):
11361137 mask = np .logical_or .reduce (masks )
11371138 for i , x in enumerate (margs ):
You can’t perform that action at this time.
0 commit comments