|
From: Andrew S. <str...@as...> - 2005-07-12 15:49:20
|
Norbert Nemec wrote:
> Andrew Straw wrote:
>
>
>>It seems MaskedArrays are the preferred way to do this. See the
>>masked_demo.py example.
>
>
> Why is that? Couldn't both be handled in the same way?
>
> The only advantage of MaskedArray is the portability to non IEEE
> systems. However, 99% of the systems in use are IEEE conformant, and
> there NaN is by far more powerful.
The reason is compatibility across platforms, and the issue is (at
least) at the level of the Python interpreter. Handling of nans and infs
depends on the hardware-specific representation and C library support.
Have you ever tried struct.pack('>f',nan)?
Maybe someday these issues will get resolved in a cross-platform manner.
Or maybe not. For now, masked arrays are the way to go.
A couple threads of interest:
http://groups-beta.google.com/group/comp.lang.python/msg/16dbf848c050405a
http://aspn.activestate.com/ASPN/Mail/Message/numpy-discussion/2549894
Cheers!
Andrew
|