[SciPy-User] How to ignore NaN values and -32767 in numpy array

questions anon questions.anon@gmail....
Mon Aug 22 18:25:54 CDT 2011


yahhh that worked! thank you.
I was showing all the code so maybe it is something with NETCDF4.
Thanks again!!

On Tue, Aug 23, 2011 at 9:12 AM, Robert Kern <robert.kern@gmail.com> wrote:

> On Mon, Aug 22, 2011 at 18:00, questions anon <questions.anon@gmail.com>
> wrote:
> > Thank you, that is good to know, but that is not the case for this. I
> know I
> > have blank data or something in a couple of sections and when I choose to
> > print around those figures I still end up with what happens below (shown
> > again).
> >  [[-- -- -- ..., -- -- --]
> >   [-- -- -- ..., -- -- --]
> >   [-- -- -- ..., -- -- --]
> >   ...,
> > And then when I make this into one big array these turn into
> >   [ -3.27670000e+04  -3.27670000e+04  -3.27670000e+04 ...,
>  -3.27670000e+04
> >     -3.27670000e+04  -3.27670000e+04]
> > Is there a way to identify these blanks and ignore them from the
> analyses?
>
> Or, right, sorry. The -- indeed are masked values. Somehow, you are
> using masked_arrays. I don't know if the netCDF4 module is doing that
> for you automatically or if you are using different code than what you
> showed.
>
> numpy.concatenate() will ignore that the array is a masked_array and
> just treat it as if it were a regular numpy ndarray, and lose the mask
> information. You will need to use numpy.ma.concatenate() instead.
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
>   -- Umberto Eco
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20110823/9576ed0b/attachment.html 


More information about the SciPy-User mailing list