[Numpy-discussion] change the mask state of one element in a masked array

Chao YUE chaoyuejoy@gmail....
Sun Feb 19 02:39:47 CST 2012


thanks.

2012/2/18 Eric Firing <efiring@hawaii.edu>

> On 02/18/2012 05:52 AM, Chao YUE wrote:
> > Dear all,
> >
> > I built a new empty masked array:
> >
> > In [91]: a=np.ma.empty((2,5))
>
> Of course this only makes sense if you are going to immediately populate
> the array.
>
> >
> > In [92]: a
> > Out[92]:
> > masked_array(data =
> >   [[  1.20569155e-312   3.34730819e-316   1.13580079e-316
> 1.11459945e-316
> >      9.69610549e-317]
> >   [  6.94900258e-310   8.48292532e-317   6.94900258e-310
> 9.76397825e-317
> >      6.94900258e-310]],
> >               mask =
> >   False,
> >         fill_value = 1e+20)
> >
> >
> > as you see, the mask for all the elements are false. so how can I set
> > for some elements to masked elements (mask state as true)?
> > let's say, I want a[0,0] to be masked.
>
> a[0,0] = np.ma.masked
>
> Eric
>
> >
> > thanks & cheers,
> >
> > Chao
> >
> > --
> >
> ***********************************************************************************
> > Chao YUE
> > Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> > UMR 1572 CEA-CNRS-UVSQ
> > Batiment 712 - Pe 119
> > 91191 GIF Sur YVETTE Cedex
> > Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
> >
> ************************************************************************************
> >
> >
> >
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120219/be6df8aa/attachment.html 


More information about the NumPy-Discussion mailing list