[Numpy-discussion] One more wrinkle in going to 5.0

Charles Doutriaux doutriaux1 at llnl.gov
Thu Jun 5 12:25:54 EDT 2008


Arthur
I'm forwarding your question to the numpy list, I'm hoping somebody 
there will be able to help you with that.

C.

Arthur M. Greene wrote:
> Hi All,
>
> This does not involve the CDAT-5 code, but rather files pickled under 
> earlier versions of CDAT. These files store the variable type along 
> with the data, but some types from 4.x are absent in 5.0, making the 
> pickled files unreadable. Example:
>
> $ cdat2
> Executing /home/amg/usr/local/cdat/5.0.0.beta1/bin/python
> Python 2.5.2 (r252:60911, May 30 2008, 11:00:23)
> [GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import cPickle as pickle
> >>> f=open('pickled/prTS2p1_Ind.p')
> >>> pr=pickle.load(f)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named cdms.tvariable
> >>>
>
> $ grep cdms pickled/prTS2p1_Ind.p
> (ccdms.tvariable
> (icdms.grid
> (icdms.axis
> (icdms.axis
> ((icdms.axis
>
> If I replace "cdms" with "cdms2" (using sed) and try again, a new 
> error comes up:
>
> >>> f=open('prTS2p1_Ind1.p')
> >>> pr=pickle.load(f)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named Numeric
>
> $ grep -B 3 -A 3 Numeric prTS2p1_Ind1.p
> (dp22
> S'gridtype'
> p23
> cNumeric
> array_constructor
> p24
> ((I1
>
> Numpy does not have an array_constructor attribute, so can't simply 
> replace "Numeric" with "numpy" in this case. If I replace instead with 
> "numpy.oldnumeric," trying to unpickle produces what appears to be a 
> screen dump (in the python console) of the pickled file as text, but 
> there is no assignment. So I'm presently at a loss as to how to read 
> such files. I have hundreds of files that were pickled under 4.x, so 
> this could be a big headache...
>
> Thx for any ideas,
>
> Arthur
>
>
> *^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*
> Arthur M. Greene, Ph.D.
> The International Research Institute for Climate and Society
> The Earth Institute, Columbia University, Lamont Campus
> amg -at- iri -dot- columbia -dot- edu
> *^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*^*~*
>
>
>
> -- 




More information about the NumPy-Discussion mailing list