[Numpy-discussion] saving 3d array
Sat Jun 15 11:06:51 CDT 2013
On Jun 15, 2013, at 17:35 , Matthew Brett <email@example.com> wrote:
> On Sat, Jun 15, 2013 at 2:51 PM, Sudheer Joseph
> <firstname.lastname@example.org> wrote:
>> Thank you very much for this tip.
>> Is there a typical way to save masked and the rest separately?. Not much familiar with array handling in numpy.
> I don't use masked array myself, but it looks like it would be something like:
> eof1_unmasked = np.array(eof1)
> eof1_mask = eof1.mask
> then you could save those two. Maybe a more maskey person could comment?
Instead of `eof1_unmasked=np.array(eof1)`, you could do `eof1_unmasked = eof1.data`. The '.data' attribute points to a view of the masked array as a simple ndarray.
You may also wanna try `eof1.torecords()` that will return a structured array with dtype `[('_data',type_of_eof1),('_mask', bool)]`.
More information about the NumPy-Discussion