[Numpy-discussion] Should ma.array.clip allow masked min and max?

Sasha ndarray at mac.com
Wed Mar 22 15:14:04 CST 2006

Pierre has implemented the clip method for ma.array, but his
implementation does not seem to do the right thing if min or max is

>>> from numpy.core.ma import *
>>> x = ones(3)
>>> max = array([0,2,0],mask=[1,1,1])
>>> min = array([0,2,0],mask=[1,1,1])
>>> x.clip(min,max)
array([1 1 1])


>>> x.clip(min.data,max.data)
array([0 2 0])

I believe it would be better to mask the elements in the result for
which either min or max is masked.

More information about the Numpy-discussion mailing list