From: Francesc A. <fa...@ca...> - 2005-06-29 20:18:15
|
Hi,=20 If what you need is a series of lists using the same order that the =46ile iterator returns, this would work: i =3D 0 for node in h5file: type_node =3D node._v_attrs.CLASS if type_node =3D=3D "Group": components_list.append({'id':i, 'name':node._v_hdf5name, 'type':type_node, 'shape':'', 'nbrows':'', 'filename':filename, 'fixingValue':"", 'valueSelection':""} elif type_node =3D=3D "Table": components_list.append({'id':i, 'name':node._v_hdf5name, 'type':type_node, 'shape':node.shape, 'nbrows':node.nrows, 'filename':filename, 'fixingValue':"", 'valueSelection':""}) i +=3D 1 or something similar, depending on your exact need. Cheers, A Monday 27 June 2005 16:36, phi...@ho... va escriure: > Hi list, > I asked this question a month ago, but nobody answered it. > I try again we never know :). > > The print method for an hdf5 file object displays the object Tree. > I would like to create a list containing the name of the hdf5 components > in the same order as in the hdf5 file object. > I tryied walkGroups and walkNodes method but without success. > > Has someone ever tryied and succeeded ? > Or do you have any suggestions? > > Here is the code i used: > 1. > for node in h5file: > components_list.append({'name':node._v_name, > 'type':node._v_attrs.CLASS}) > 2. > i=3D0 > for group in self.__h5file.walkGroups("/"): >=20 > components_list.append({'id':i,'name':group._v_hdf5name,'type':"Group",'s= ha >pe':'','nbrows':'','filename':filename,'fixingValue':"",'valueSelection':"= "} >) for array in self.__h5file.listNodes(group, classname =3D 'Array'): > components_list.append({'id':i,'name':array._v_hdf5name,'type':"Array",'s= ha >pe':array.shape,'nbrows':array.type,'filename':filename,'fixingValue':"",'= va >lueSelection':""}) i=3Di+1 > for table in self.__h5file.listNodes(group, "Table"): > components_list.append({'id':i,'name':table._v_hdf5name,'type':"Table",'s= ha >pe':table.shape,'nbrows':table.nrows,'filename':filename,'fixingValue':"",= 'v >alueSelection':""}) i=3Di+1 > i=3Di+1 > > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=3D7477&alloc_id=3D16492&op=3Dclick > _______________________________________________ > Pytables-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pytables-users =2D-=20 >0,0< Francesc Altet =A0 =A0 http://www.carabos.com/ V V C=E1rabos Coop. V. =A0=A0Enjoy Data "-" |