From: Valentino A. <val...@co...> - 2005-05-12 12:32:24
|
> -----Messaggio originale----- > Da: Francesc Altet [mailto:fa...@ca...] > Inviato: giovedì 12 maggio 2005 11.05 > A: Valentino Antonio > Cc: pyt...@li... > Oggetto: Re: R: [Pytables-users] Re: [ pytables-Patches-1192700 ] > Multi-dimensional HDF5 attributes > > > A Dijous 12 Maig 2005 09:16, vàreu escriure: > > No. The contrary. In my opinion, python integers and float should be > > pickled. > > Numarray objects, including scalars, should be saved as numeric HDF5 > > attributes. > > In this way numeric HDF5 attributes will be *always* loaded > into pytables > > as numarray objects, and numarray objects will be *always* > saved on file as > > numeric > > HDF5 attributes (H5T_NATIVE_INT, H5T_NATIVE_FLOAT and so on). > > Python objects, including int, float, complex, decimal.Decimal, list, > > tuple, dict, etc, should be saved as cpickle strings in order > to not have > > ambiguities with > > numeric attributes. > > In this way you can write code like this > > > > leaf.attrs.uchar = na.array(1, type=na.UInt8) # --> H5T_NATIVE_UCHAR > > integet = 1 > > leaf.attrs.int = integer # --> cpickle string > > leaf.attrs.int32 = na.asarray(integer) # --> H5T_NATIVE_INT > > > > and then retrieve them back unambiguously. > > Stated that extra code is needed in order to preserve the compatibility > > with old pytables version, I don't know if this approach can > araise other > > problems. > > I hope I have not been too much confusing. > > No, I understand clearly now. :))) > Well, after discussing this issue with > Ivan, we think that your suggestion is very consistent. And, as we can > distinguish between files made with PyTables 1.0 and earlier from > those made with PyTables 1.1 and after, I think there will be no > problem in implementing that. I'm happy to hear this. > May you provide the necessary patch based on the latest snapshot? If > you can't, I can do it my self. Of course I can. I will make it available this weekend (I hope). > Thanks, > > -- > >0,0< Francesc Altet http://www.carabos.com/ > V V Cárabos Coop. V. Enjoy Data > "-" > ciao -- Antonio Valentino |