def get_none_or_array(arr, ndim, masked=False): if ndim == 1: ret = get_none_or_1d(arr) elif ndim == 2: ret = get_none_or_2d(arr) else: raise NotImplementedError if ret is not None and masked and not isinstance(ret, np.ma.MaskedArray): ret = np.ma.array(ret, mask=False) return ret
def _get_none_or_array_(self,arr,masked=False): if self._ndims == 1: ret = get_none_or_1d(arr) elif self._ndims == 2: ret = get_none_or_2d(arr) else: raise(NotImplementedError) if ret is not None and masked and not isinstance(ret,np.ma.MaskedArray): ret = np.ma.array(ret,mask=False) return(ret)