title: How to overwrite array inside h5 file using h5py
body: <p>I'm trying to overwrite a numpy array that's a small part of a pretty complicated h5 file.  </p>
  
  <p>I'm extracting an array, changing some values, then want to re-insert the array into the h5 file.</p>
  
  <p>I have no problem extracting the array that's nested. </p>
  
  <pre><code>f1 = h5py.File(file_name,'r')
  X1 = f1['meas/frame1/data'].value
  f1.close()
  </code></pre>
  
  <p>My attempted code looks something like this with no success:</p>
  
  <pre><code>f1 = h5py.File(file_name,'r+')
  dset = f1.create_dataset('meas/frame1/data', data=X1)
  f1.close()
  </code></pre>
  
  <p>As a sanity check, I executed this in Matlab using the following code, and it worked with no problems.  </p>
  
  <pre><code>h5write(file1, '/meas/frame1/data', X1);
  </code></pre>
  
  <p>Does anyone have any suggestions on how to do this successfully?</p>