We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Need to test the input of a function to adapt its behaviour to either a classic np.ndarray or a np.ma.masked_array?
np.ndarray
np.ma.masked_array
Beware, as np.ma.masked_array is a subclass of np.ndarray, and so isinstance(arr, np.ndarray) will return True for both.
isinstance(arr, np.ndarray)
True
To check if the input array is a classic numpy array which is not masked, one can write:
isinstance(arr, np.ndarray) and not np.ma.is_masked(arr)