[Numpy-discussion] the axis parameter in the np.ma.concatenate is not working?

Chao YUE chaoyuejoy at gmail.com
Thu Oct 13 13:17:48 EDT 2011


Dear all,

I use numpy version 1.5.1 which is installed by default when I do sudo
apt-get install numpy on ubuntu 11.04.
but it seems that for np.ma.concatenate(arrays, axis), the axis parameter is
not working?

In [460]: a=np.arange(10)

In [461]: a=np.ma.masked_array(a,a<3)

In [462]: a
Out[462]:
masked_array(data = [-- -- -- 3 4 5 6 7 8 9],
             mask = [ True  True  True False False False False False False
False],
       fill_value = 999999)


In [463]: b=np.arange(10)

In [464]: b=np.ma.masked_array(a,b>7)

In [465]: b
Out[465]:
masked_array(data = [-- -- -- 3 4 5 6 7 -- --],
             mask = [ True  True  True False False False False False  True
True],
       fill_value = 999999)


In [466]: c=np.ma.concatenate((a,b),axis=0)

In [467]: c
Out[467]:
masked_array(data = [-- -- -- 3 4 5 6 7 8 9 -- -- -- 3 4 5 6 7 -- --],
             mask = [ True  True  True False False False False False False
False  True  True
  True False False False False False  True  True],
       fill_value = 999999)


In [468]: c.shape
Out[468]: (20,)

In [469]: c=np.ma.concatenate((a,b),axis=1)

In [470]: c.shape
Out[470]: (20,)

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


More information about the NumPy-Discussion mailing list