Некоторые данные необходимо записать в файл HDF5 различными этапами, а пример кода размещен ниже.Проблема, с которой я сталкиваюсь, заключается в том, что существующая группа h5 и набор данных были очищены при повторном запуске нового шага, включая открытие и запись.
import h5py
import numpy as np
a=r"F:\HY1A1B\cd.h5"
#first open and write
b=h5py.File(a, 'w')
zeroPixelCounts = np.zeros((5,10))
QC_Attribute = b.create_group("QC Attributes")
QC_Attribute.create_dataset("Zero Pixel Counts",(5,10),data=zeroPixelCounts)
b.close()
#second open and write
b=h5py.File(a, 'w')
QC_Attributex = b.create_group("QC Attributes xxxx")
QC_Attributex.create_dataset("Zero Pixel Counts",(5,10),data=zeroPixelCounts)
b.close()
#problem:the existing data in first open and write processing were cleaned