@@ -907,7 +907,11 @@ def process_value(value):
907907 if np .issubdtype (dtype , np .integer ) or dtype .type is np .bool_ :
908908 # bool_/int8/int16 -> float32; int32/int64 -> float64
909909 dtype = np .promote_types (dtype , np .float32 )
910- result = np .ma .array (value , dtype = dtype , copy = True )
910+ # ensure data passed in as an ndarray subclass are interpreted as
911+ # an ndarray. See issue #6622.
912+ mask = np .ma .getmask (value )
913+ data = np .asarray (np .ma .getdata (value ))
914+ result = np .ma .array (data , mask = mask , dtype = dtype , copy = True )
911915 return result , is_scalar
912916
913917 def __call__ (self , value , clip = None ):
@@ -937,9 +941,7 @@ def __call__(self, value, clip=None):
937941 result = np .ma .array (np .clip (result .filled (vmax ), vmin , vmax ),
938942 mask = mask )
939943 # ma division is very slow; we can take a shortcut
940- # use np.asarray so data passed in as an ndarray subclass are
941- # interpreted as an ndarray. See issue #6622.
942- resdat = np .asarray (result .data )
944+ resdat = result .data
943945 resdat -= vmin
944946 resdat /= (vmax - vmin )
945947 result = np .ma .array (resdat , mask = result .mask , copy = False )
@@ -1007,7 +1009,7 @@ def __call__(self, value, clip=None):
10071009 if clip :
10081010 mask = np .ma .getmask (result )
10091011 result = np .ma .array (np .clip (result .filled (vmax ), vmin , vmax ),
1010- mask = mask )
1012+ mask = mask )
10111013 # in-place equivalent of above can be much faster
10121014 resdat = result .data
10131015 mask = result .mask
0 commit comments