NumPy

numpy.ma.MaskType.ndim

attribute

MaskType.ndim

number of array dimensions