示例#1
0
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
示例#2
0
文件: base.py 项目: UV-CDAT/ocgis
 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)