[Numpy-discussion] array metadata

Derek Homeier derek@astro.physik.uni-goettingen...
Thu Jan 26 07:49:58 CST 2012


On 26 Jan 2012, at 13:30, Paul Anton Letnes wrote:

> If by "store" you mean "store on disk", I recommend h5py datasets and
> attributes. Reportedly pytables is also good but I don't have any
> first hand experience there. Both python modules use the hdf5 library,
> written in C/C++/Fortran.
> 
> Paul
> 
> On Wed, Jan 25, 2012 at 7:47 PM, Val Kalatsky <kalatsky@gmail.com> wrote:
>> 
>> I believe there are no provisions made for that in ndarray.
>> But you can subclass ndarray.
> 
You could probably use structured arrays with string and datetype fields for the 
metadata and multidimensional fields (i.e. effectively subarrays within the 
structured array) for the actual data. For file storage, they could probably be directly 
saved as .npy, if interoperability is not a concern. Otherwise I'd also highly recommend 
hdf5; with both h5py and pytables allowing quite transparent conversion of structured 
arrays to datasets in the HDF5, but you also have the option to store other objects, 
like dictionary elements, within the same data structure. 
Pytables is generally regarded as having a more database-oriented approach, 
while h5py appears more straightforward to use from a numerics background 
(at least in my experience).

Cheers,
						Derek



More information about the NumPy-Discussion mailing list