numpy masked_where

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top