如何(1)批量選擇hdf5文件下的所有數組,然後(2)對這些數組應用計算,最後(3)在另一個hdf5文件中批量創建新數組?如何在Numpy中批量選擇和計算數組?
例如:
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)
我下單HDF5文件和幾個HDF5文件100+陣列,我怎麼能批量處理他們?非常感謝。
你的HDF文件的結構是什麼?例如,所有的數組都掛在根上?你是否希望在新文件中複製該結構? – dtlussier