nlcpy.ma.is_mask
- nlcpy.ma.is_mask(m)[source]
Returns True if m is a valid, standard mask.
This function does not check the contents of the input, only that the type is MaskType. In particular, this function returns False if the mask has a flexible dtype.
- Parameters
- marray_like
Array to test.
- Returns
- resultbool
True if m.dtype.type is MaskType, False otherwise.
Examples
>>> import nlcpy as vp >>> import nlcpy.ma as ma >>> mask = [True, False, True, False, False] >>> m = ma.array([0, 1, 0, 2, 3], mask=mask, fill_value=0) >>> m masked_array(data=[--, 1, --, 2, 3], mask=[ True, False, True, False, False], fill_value=0) >>> ma.is_mask(m) False >>> ma.is_mask(m.mask) True
Input must be an ndarray (or have similar attributes) for it to be considered a valid mask.
>>> m = [False, True, False] >>> ma.is_mask(m) False >>> m = vp.array([False, True, False]) >>> m array([False, True, False]) >>> ma.is_mask(m) True