[Numpy-discussion] saving 3d array

Sudheer Joseph sudheer.joseph at yahoo.com
Sat Jun 15 08:22:24 EDT 2013


Dear Experts,
                    I was trying to save results of eof analysis to an npz file and see that it is not possible to save a 3d array as npz file variable. Is this true even today or are there developments which make this possible?  I am able to save all other variables except the 3d array.
with best regards,
Sudheer

 eof1.shape
Out[61]: (10, 140, 180)

pc1.shape
Out[62]: (2192, 10)

x.shape
Out[63]: (140, 180)

np.savez(outf,pcs=pc1,x=x,y=y,clevs=clevs)

works fine
but below do not

np.savez(outf,eof1=eof1)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
/home/sjo/RAMA_20120807/adcp/<ipython-input-66-fe5940e44a77> in <module>()
----> 1 np.savez(outf,eof1=eof1)

/usr/local/lib/python2.7/dist-packages/numpy-1.7.0-py2.7-linux-x86_64.egg/numpy/lib/npyio.pyc in savez(file, *args, **kwds)
    514 
    515     """
--> 516     _savez(file, args, kwds, False)
    517 
    518 def savez_compressed(file, *args, **kwds):

/usr/local/lib/python2.7/dist-packages/numpy-1.7.0-py2.7-linux-x86_64.egg/numpy/lib/npyio.pyc in _savez(file, args, kwds, compress)
    573             fid = open(tmpfile, 'wb')
    574             try:
--> 575                 format.write_array(fid, np.asanyarray(val))
    576                 fid.close()
    577                 fid = None

/usr/local/lib/python2.7/dist-packages/numpy-1.7.0-py2.7-linux-x86_64.egg/numpy/lib/format.pyc in write_array(fp, array, version)
    407     else:
    408         if isfileobj(fp):
--> 409             array.tofile(fp)
    410         else:
    411             # XXX: We could probably chunk this using something like


/usr/local/lib/python2.7/dist-packages/numpy-1.7.0-py2.7-linux-x86_64.egg/numpy/ma/core.pyc in tofile(self, fid, sep, format)
   5380 
   5381         """
-> 5382         raise NotImplementedError("Not implemented yet, sorry...")
   5383 
   5384     def toflex(self):

NotImplementedError: Not implemented yet, sorry...

***************************************************************
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 at gmail.com;sudheer.joseph at yahoo.com
Web- http://oppamthadathil.tripod.com
***************************************************************



More information about the NumPy-Discussion mailing list