From: Anthony S. <sc...@gm...> - 2012-06-14 18:30:35
|
On Wed, Jun 13, 2012 at 8:23 PM, Andre' Walker-Loud <wal...@gm...>wrote: > Hi All, > > Still trying to sort out a recursive walk through an hdf5 file using > pytables. > > I have an hdf5 file with an unknown depth of groups/nodes. > > I am trying to write a little function to walk down the tree (with user > input help) until a data file is found. > > I am hoping there is some function one can use to query whether you have > found simply a group/node or an actual numpy array of data. So I can do > something like > > if f.getNode('/',some_path) == "data_array": > return f.getNode('/',some_path), True > else: > return f.getNode('/',some_path), False > > where I have some function that if the second returned variable is True, > will recognize the file as data, where as if it is False, it will query the > user for a further path down the tree. > > > I suppose I could set this up with a try: except: but was hoping there is > some built in functionality to handle this. > Yup, I think that you are looking for the File.walkNodes() method. http://pytables.github.com/usersguide/libref.html#tables.File.walkNodes Be Well Anthony > > > Thanks, > > Andre > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Pytables-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pytables-users > |