I think this is a floating point precision issue.

https://docs.python.org/3.6/tutorial/floatingpoint.html

On Fri, Dec 15, 2017 at 1:40 PM, Jesper Larsen <jesper.webm...@gmail.com>
wrote:

> 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
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
>
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to