[Numpy-discussion] Warnings in numpy.ma.test()

Christopher Barker Chris.Barker@noaa....
Thu Mar 18 18:26:04 CDT 2010


josef.pktd@gmail.com wrote:
>> I'm facing this at the moment: not a big deal, but I'm using histogram2d
>> on some data. I just realized that it may have some NaNs in it, and I
>> have no idea how those are being handled.

> histogram2d handles neither masked arrays nor arrays with nans
> correctly,

I really wasn't asking for help (yet) .. but thanks!

>>>> x2=x[:,np.isfinite(x).all(0)]
>>>> np.histogram2d(x2[0],x2[1],bins=3)
> (array([[ 0.,  0.,  1.],
>        [ 0.,  0.,  0.],
>        [ 1.,  0.,  0.]]), array([ 1.        ,  1.66666667,
> 2.33333333,  3.        ]), array([ 1.        ,  1.33333333,
> 1.66666667,  2.        ]))

I'll probably do something like that for now. I guess the question is -- 
should this be built in to histogram2d (and other similar functions)?

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list