[Numpy-discussion] Appending/combining masked arrays
Wed Sep 29 16:46:03 CDT 2010
On Wed, Sep 29, 2010 at 5:37 PM, Pierre GM <firstname.lastname@example.org> wrote:
> On Sep 29, 2010, at 11:01 PM, Gökhan Sever wrote:
>> Consider these two simple masked arrays:
>> I: a = np.ma.masked_equal([1,2,3], value=2)
>> I: b = np.ma.masked_equal([4,3,2], value=2)
>> An operation like this voids the mask:
>> I: np.append(a,b)
>> masked_array(data = [1 2 3 4 3 2],
>> mask = False,
>> fill_value = 999999)
> You're using a standard numpy function on a masked array. It's hardly surprising that you run into some issues. You should use the np.ma equivalent. Except of course that the equivalent doesn't exist yet... Please open a ticket.
> In the mean time, do it manually:
> * combining the .data of each item (masked array) of your list is straightforward
> * repeat for the masks. I advise you to use the getmaskarray function to get the mask of each item, otherwise you may get a `nomask` in the middle which will complicate things
> * combine the the two results in a new masked array.
any of the ma stack array function might also work, or not?
> NumPy-Discussion mailing list
More information about the NumPy-Discussion