W
Wanderer
Why does the numpy masked_where create a special case for all False?
import numpy
x = numpy.array([[9,9,9,9,9,9],[9,9,9,9,9,9],[9,9,9,9,9,9],[9,9,9,9,9,9]])
y = numpy.ma.masked_where(x<3,x)
y.mask
Out[1]: False
z= numpy.arange(20)
z.reshape(4,5)
Out[1]:
array([[ 0, 1, 2, 3, 4],
[ 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14],
[15, 16, 17, 18, 19]])
y = numpy.ma.masked_where(z<3,z)
y.mask
Out[1]:
array([ True, True, True, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False,
False, False], dtype=bool)
Is there a good way to work around this and get an all False array?
Thanks
import numpy
x = numpy.array([[9,9,9,9,9,9],[9,9,9,9,9,9],[9,9,9,9,9,9],[9,9,9,9,9,9]])
y = numpy.ma.masked_where(x<3,x)
y.mask
Out[1]: False
z= numpy.arange(20)
z.reshape(4,5)
Out[1]:
array([[ 0, 1, 2, 3, 4],
[ 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14],
[15, 16, 17, 18, 19]])
y = numpy.ma.masked_where(z<3,z)
y.mask
Out[1]:
array([ True, True, True, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False,
False, False], dtype=bool)
Is there a good way to work around this and get an all False array?
Thanks