[Numpy-discussion] saving 3d array

Sudheer Joseph sudheer.joseph@yahoo....
Mon Jun 17 00:08:32 CDT 2013


Thank you Camilo,
                     It is indeed an easy way and also the link is a ready to use save method. Thanks a lot for sharing it 

with best regards,
Sudheer

 
***************************************************************
Sudheer Joseph 
Indian National Centre for Ocean Information Services
Ministry of Earth Sciences, Govt. of India
POST BOX NO: 21, IDA Jeedeemetla P.O.
Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55
Tel:+91-40-23886047(O),Fax:+91-40-23895011(O),
Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile)
E-mail:sjo.India@gmail.com;sudheer.joseph@yahoo.com
Web- http://oppamthadathil.tripod.com
***************************************************************


>________________________________
> From: Camilo Andrés Jimenez Cruz <camilo.jimenezc@gmail.com>
>To: Discussion of Numerical Python <numpy-discussion@scipy.org> 
>Sent: Sunday, 16 June 2013 11:37 PM
>Subject: Re: [Numpy-discussion] saving 3d array
> 
>
>
>Hi!
>
>
>I know it is pretty much the same as you did before, but has been useful for me in the past. Instead of saving each array separately, just create a dictionary and save the it, something like
>
>
>d= {put_all_your_arrays_here}
>savez_compressed('file.npz', **d) 
>
>
>
>-- Camilo Jiménez
>
>
>
>On Sat, Jun 15, 2013 at 2:11 PM, Eric Firing <efiring@hawaii.edu> wrote:
>
>On 2013/06/15 6:06 AM, Pierre GM wrote:
>>>
>>> On Jun 15, 2013, at 17:35 , Matthew Brett <matthew.brett@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> On Sat, Jun 15, 2013 at 2:51 PM, Sudheer Joseph
>>>> <sudheer.joseph@yahoo.com> 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)]`.
>>
>>For automated saving and restoring, try this:
>>
>>http://currents.soest.hawaii.edu/hgstage/pycurrents/file/686c2802a6c4/file/npzfile.py
>>
>>Eric
>>
>>
>>_______________________________________________
>>NumPy-Discussion mailing list
>>NumPy-Discussion@scipy.org
>>http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>
>_______________________________________________
>NumPy-Discussion mailing list
>NumPy-Discussion@scipy.org
>http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130617/0bfc3434/attachment-0001.html 


More information about the NumPy-Discussion mailing list