From: <phi...@ho...> - 2005-06-27 14:36:50
|
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=0 for group in self.__h5file.walkGroups("/"): components_list.append({'id':i,'name':group._v_hdf5name,'type':"Group",'shape':'','nbrows':'','filename':filename,'fixingValue':"",'valueSelection':""}) for array in self.__h5file.listNodes(group, classname = 'Array'): components_list.append({'id':i,'name':array._v_hdf5name,'type':"Array",'shape':array.shape,'nbrows':array.type,'filename':filename,'fixingValue':"",'valueSelection':""}) i=i+1 for table in self.__h5file.listNodes(group, "Table"): components_list.append({'id':i,'name':table._v_hdf5name,'type':"Table",'shape':table.shape,'nbrows':table.nrows,'filename':filename,'fixingValue':"",'valueSelection':""}) i=i+1 i=i+1 |