def WriteToHDF(outHDFFile, refResultArr, processStatus): hdfFile = SD(outHDFFile, SDC.WRITE | SDC.CREATE | SDC.TRUNC) # Assign a few attributes at the file level hdfFile.author = 'author' hdfFile.priority = 2 bandT = 0 for i in range(0, CF.Nbands): if (not processStatus[i]): continue #print refResultArr[::bandT].shape, refResultArr[::bandT].shape[0], refResultArr[::bandT].shape[1] # Create a dataset named 'd1' to hold a 3x3 float array. #d1 = hdfFile.create(CF.refBandNames[i], SDC.UINT16, (refResultArr.shape[0], refResultArr.shape[1])) d1 = hdfFile.create(CF.refBandNames[i], SDC.FLOAT32, (refResultArr.shape[0], refResultArr.shape[1])) # Set some attributs on 'd1' d1.description = 'simple atmosphere correction for ' + CF.refBandNames[ i] d1.units = 'Watts/m^2/micrometer/steradian' # Name 'd1' dimensions and assign them attributes. dim1 = d1.dim(0) dim2 = d1.dim(1) # Assign values to 'd1' d1[:] = refResultArr[:, :, bandT] #print refResultArr[:,:,bandT].shape bandT += 1 d1.endaccess() hdfFile.end()