1

Possible Duplicate:
Removing data from a HDF5 file

I have an hdf5 file, which contains a group structure like:

-->"Databases"  
    --> "Some name of some db"
       --> Some field
          --> Table 1
             --> Table 2
             --> Table 3
       --> Some other field
             --> Table 1
             --> Table 2

I would like to iterate through this, and delete "Some other field". I achieve this by the line

h5file.removeNode(db, field_name, recursive=True) where db is the object for "Some name of some db" and the field name is the string "Some other field".

When I flush and save, the group is now removed (yay!), but the file size is the same (boo!). In this case my file size was 1.2Gb to begin with, and I removed the groups containing about 95% of the data (I kept only 1 of about 20 "fields").

Am I missing something? Is a group somehow just metadata, and the underlying array data still somehow there? How to do I go through and make a smaller file, containing only the information I need?

Any tips would be greatly appreciated.

Community
  • 1
  • 1
Tennessee Leeuwenburg
  • 1,693
  • 1
  • 12
  • 9
  • Just a guess: I had a similar situation with another file some time ago. The solution for me was to completely re-create the file (read and create new). :-/ – Thomas Schwärzl Oct 12 '12 at 06:19

0 Answers0