f['numbers'][:]+=5
works.
f['numbers'] + 5
does not work because the Dataset object does not have methods like __add__
. So the Python interpreter gives you the unsupported
error.
Adding the [:]
gives an ndarray
, with the full set of numpy
methods.
Doesn't the documentation talk about loading slices of the data into memory?
`f['numbers'][:10] += 5
might work as way to change a portion. The addition is still being done in memory.
See earlier questions like
How to store an array in hdf5 file which is too big to load in memory?
Another option is to look at the compiled h5
code. There probably are Fortran or C based scripts which will make changes to the data like this. You could easily call those from Python.