Ben Axelrod wrote:
> 3.  Both of the above mentioned bandaid fixes suffer from some bug (I 
> think in numpy).   Where the min() and max() of a numpy array where the 
> first value is NaN, bugs out:
> 
>  
> 
> x = np.asarray([None, 1, 2, 3, 4, 5, 6, 7, 8, 9], float)
> 
> y = np.asarray([0, 1, 2, 3, 4, 5, 6, 7, 8, None], float)
> 
> z = np.asarray([0, 1, 2, 3, 4, 5, None, 7, 8, 9], float)
> 
>  
> 
> print min(x), max(x)  #prints 1.#QNAN 1.#QNAN
> 
> print min(y), max(y)  #prints 0.0 8.0
> 
> print min(z), max(z)  #pritns 0.0 9.0

It's actually pure luck that min/max worked at all.  What you want is 
numpy.nanmax() and numpy.nanmin() which properly handle NaN's in your array.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to