A Monday 19 May 2008, Glenn escrigué: > I am working on refining some algorithms to process some spectral > data I have stored in an h5 file using PyTables. The data is stored > as an EArray. As I work on my algorithm, I'd like to store > intermediate computations in the same h5 file. The trouble I am > having is as follows: > I create a new EArray to store the intermediate result > Then I iterate through my data, appending my results to the EArray > If I then realize I've made a mistake in computing the intermediate > result, I have to do something like: > try: > res = fh.getNode(grp, 'res') > res.remove() > except: > pass > res = fh.createEArray(grp, 'res', Float32Atom(), (0,512)) > > in order to remove the old array so that I can start fresh. This > seems to be slow and cumbersome. > Is there any better way to do this? Perhaps a way to tell the EArray > to start at the beginning again so subsequent append operations > overwrite old data?
EArray objects supports data overwriting: res[slice] = your_new_data So, you can re-write your data until the point you've made the mistake, and then continue to append. If you know the final number of rows on your disk-array, you may find easy to use a CArray and then use regular assignments to fill it (as if it were an in-memory array). Hope that helps, -- Francesc Alted ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users