[Numpy-discussion] how to combine (stack) two masked arrays?

Jim Vickroy Jim.Vickroy at noaa.gov
Thu Mar 1 17:05:45 EST 2007


Hello all,

I am stuck in my attempts to use masked arrays to combine the contents 
of two arrays (please see the masked-arrays.py attachment) such that 
missing values in one array are provided by the second array.  There are 
no ambiguities in the combination operation because each of the two 
arrays only has values where the other array does not.

Referring to masked-arrays.py, I want to apply some function/operator to 
the *clipped_mask* and *rescaled* arrays to obtain the following result:

[[0 0 0 0 0]
 [0 1220 4095 1220 0]
 [1220 4095 4095 4095 1220]
 [0 1220 4095 1220 0]
 [0 0 0 0 0]]

I am a new user of numpy so I would appreciate feedback on awkward areas 
in the code and/or the suitability of the approach.

Thanks,

-- jv

P.S.

Apologies if this is in the discussion archives; I was not able to find 
a similar discussion there nor in my copy of numpybook.pdf.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: masked-arrays.py
Type: application/x-python
Size: 891 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070301/c52b16ba/attachment.bin>


More information about the NumPy-Discussion mailing list