On 8/24/11 9:22 AM, Anthony Scopatz wrote: > You can use Python pickling, if you do *not* have a requirement for:
I can't recall why, but it seem pickling of numpy arrays has been fragile and not very performant. I like the npy / npz format, built in to numpy, if you don't need: > - access from non-Python programs it's quick and easy to use: In [5]: a Out[5]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) In [6]: b Out[6]: array([ 0., 1., 2., 3., 4.]) In [7]: filename = "test.npz" In [8]: np.savez(filename, a=a, b=b) In [9]: del a, b In [10]: # now reload: In [11]: data = np.load(filename) In [14]: data['a'] Out[14]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) In [15]: data['b'] Out[15]: array([ 0., 1., 2., 3., 4.]) I'd go with hdf5 or netcdf if you want a standard format that can be read by non-python software. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
