How to (1) batch select all arrays under a hdf5 file, then (2) apply calculations on those arrays and finally (3) batch create new arrays in another hdf5 file?
for example:
import numpy
import tables
file = openFile('file1',"r")
array1 = file.root.array1
array1_cal = (array1 <= 1)
newfile.createArray('/','array1_cal',array1_cal)
array2 = file.root.array2
array2_cal = (array2 <= 1)
newfile.createArray('/','array2_cal',array2_cal)
I have 100+ arrays under a single hdf5 file and several hdf5 files, how can I batch process them? Thanks a lot.
With PyTables you can use the
walkNodesfunction to recursively iterate through nodes. Here is an example: