[Numpy-discussion] an easy way to know if a functions works or not for masked array?

Chao YUE chaoyuejoy@gmail....
Fri Dec 14 08:34:28 CST 2012


Dear numpy users,

I think since long I am confused by if a function works as expected or not
for masked array.
like np.reshape works for masked array, but not np.sum (I mean, I expect
np.sum to drop the masked elements when do summing, of course we have
np.ma.sum).
So I always use fuctions preceding by np.ma to make sure there is nothing
going woring if I expect there will be masked array participating in the
calculation in the data process chain.

When I handle masked array, Before I use a function, normally I check if
there is an equivalent np.ma function and if there is, I use
np.mafunction; Then I check how the documentation says about np.func
and
np.ma.func and see there is anything mentioned explicitly on the handling
of masked array.  Howevery, In most cases I will try with simple arrays to
test both np.ma.func and np.func before I use some function. but this is
sometimes time consuming. Does anyone have similar situation?

thanks!

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
************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20121214/310d96ab/attachment.html 


More information about the NumPy-Discussion mailing list