[Numpy-discussion] masked_values behaviour

Jesper Larsen jesper.webmail at gmail.com
Fri Dec 15 16:40:42 EST 2017


Hi numpy people,

I was just wondering whether this behaviour is intended:

>>> import numpy as np
>>> np.ma.masked_values(np.array([-32768.0]), np.int16(-32768))
masked_array(data = [-32768.],
             mask = False,
       fill_value = -32768.0)

So the resulting masked array is not masked. On the other hand it is masked
in the three cases below:

>>> np.ma.masked_values(np.array([-32767.0]), np.int16(-32767))
masked_array(data = [--],
             mask = [ True],
       fill_value = -32767.0)

>>> np.ma.masked_values(np.array([-32768.0]), -32768.0)
masked_array(data = [--],
             mask = [ True],
       fill_value = -32768.0)

>>> np.ma.masked_values(np.array([-32768.0]), -32768)
masked_array(data = [--],
             mask = [ True],
       fill_value = -32768.0)

Best regards,
Jesper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20171215/02f5cd60/attachment.html>


More information about the NumPy-Discussion mailing list