Re: [Numpy-discussion] masked_values behaviour

2017-12-18 Thread Jesper Larsen
Thanks for the responses Paul and Marten, I have raised an issue for the issue at: https://github.com/numpy/numpy/issues/10227 Best regards, Jesper 2017-12-16 22:48 GMT+01:00 Marten van Kerkwijk : > Definitely a big! The underlying problem is: > ``` > In [23]: np.abs(np.int16(-32768)) > Out[23

Re: [Numpy-discussion] masked_values behaviour

2017-12-16 Thread Marten van Kerkwijk
Definitely a big! The underlying problem is: ``` In [23]: np.abs(np.int16(-32768)) Out[23]: -32768 ``` This is not great, but perhaps consistent with the logic that abs should return a value of the same dtype. It could be solved inside `masked_values` by using `np.abs(value, dtype=xnew.dtype)` Do

Re: [Numpy-discussion] masked_values behaviour

2017-12-15 Thread Paul Hobson
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 wrote: > Hi numpy people, > > I was just wondering whether this behaviour is intended: > > >>> import numpy as np > >>> np.ma.masked_values(np

[Numpy-discussion] masked_values behaviour

2017-12-15 Thread Jesper Larsen
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