Francesc Alted wrote: > A Tuesday 16 February 2010 13:19:29 Jon Olav Vik escrigué: >> Anthony Foglia <AFoglia <at> princeton.com> writes: >>>>> Is there a way to get a Description from a numpy dtype? >>> http://www.pytables.org/trac/ticket/263 >> Maybe you don't need to. This recent enhancement allows you to use a dtype >> as a description: >> http://www.pytables.org/trac/browser/trunk/tables/file.py?rev=4230 >> >> 633 `description` >> 634 This is an object that describes the table, i.e. how many >> 635 columns it has, their names, types, shapes, etc. It can be >> 636 any of the following: >> >> 650 A NumPy dtype >> 651 A completely general structured NumPy dtype is accepted >> 652 too, and its field structure will be reflected in the >> 653 new `Table` object. > > Good catch! I forgot about this capability. So, I think I can close #263 > now.
That's not quite what I was looking for. I wanted to store the description myself, so I can check pre-existing tables against that description. Our use case is that we have tables holding data for each day. We'll need to append days to the end. But sometimes we don't know if any days already exist. Essentially we need to open our data object in "r+" mode. The user will probably want to pass in a dtype to construct the table, if need be. I'd like to test the description obtained from that with the description from any pre-existing tables, and throw an error otherwise. We have a similar object that aggregates array, and for there I use Atoms. This works fine because I can convert dtypes to Atoms (and Atoms also have default values). I was thinking of using the same logic for our aggregated tables, but can't. Thinking about it more though, I shouldn't be relying so much on the description at my level, and I'll work around it, but the idea was to get a freestanding Description from a dtype, not merely to pass one in through the description argument of createTable. -- Anthony Foglia Princeton Consultants (609) 987-8787 x233 ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users