[Numpy-discussion] change the mask state of one element in a masked array
Olivier Delalleau
shish at keba.be
Sat Feb 18 11:19:49 EST 2012
There may be a better way to do it, but you can first do:
a.mask = np.zeros_like(a)
then afterwards e.g. a.mask[0, 0] = True will work.
-=- Olivier
Le 18 février 2012 10:52, Chao YUE <chaoyuejoy at gmail.com> a écrit :
> Dear all,
>
> I built a new empty masked array:
>
> In [91]: a=np.ma.empty((2,5))
>
> 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.
>
> 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 at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120218/25dd3f65/attachment.html>
More information about the NumPy-Discussion
mailing list