[Numpy-discussion] Masked arrays and pickle/unpickle

Anthony Floyd anthony.floyd@convergent...
Thu Jul 17 12:41:51 CDT 2008


  
> > What I need to know is how I can trick pickle or Numpy to 
> put the old class into the new class.
> 
> If you have an example data-file, send it to me off-list and I'll
> figure out what to do.  Maybe it is as simple as
> 
> np.core.ma = np.oldnumeric.ma

Yes, pretty much.  We've put ma.py into numpy.core where ma.py is
nothing more than:

import numpy.oldnumeric.ma as ma

class MaskedArray(ma.MaskedArray):
    pass

It works, but becomes a bit of a headache because we now have to
maintain our own numpy package so that all the developers get these
three lines when they install numpy.

Anyway, it lets us unpickle/unshelve the old data files with 1.1.0.  The
next step is to transition on the fly the old numpy.core.ma.MaskedArray
classes to numpy.ma.core.MaskedArray classes so that when oldnumeric
gets depreciated we're not stuck.

Thanks for the input,
Anthony.


More information about the Numpy-discussion mailing list