title: How to compress hdf5 file when resizing?
body: <p>Here is my code:</p>
  
  <pre><code>n = 100000       #This is what makes it tricky - lots of files going into this hdf5 file
  
  with h5py.File('image1.h5','w') as f:
      dset_X = f.create_dataset('X',(1,960,224,224),maxshape=(None,960,224,224),chunks=True,compression='gzip')
      dset_y = f.create_dataset('y',(1,112,224*224),maxshape=(None,112,224*224),chunks=True,compression='gzip')
      n_images = 0
      for fl in files[:n]:
          X_chunk,y_chunk = get_arrays(fl)
          dset_X.resize(n_images+1,axis=0)
          dset_y.resize(n_images+1,axis=0)
          print dset_X.shape,dset_y.shape
          dset_X[n_images:n_images+1,:,:,:]=X_chunk
          dset_y[n_images:n_images+1,:,:]=y_chunk
          n_images+=1
  </code></pre>
  
  <p>This works fine and dandy. However, with 1 file, the size of the hdf5 is 6.7MB. With 2 files its 37MB ( should be 12 MB right?). With 10 its all the way up to 388MB (should be 67 right?)</p>
  
  <p>So clearly adding the compression flag to the end of the 2nd and third line isn't working as intended. How can I achieve something like this? </p>