can you write in your question an example of what the values of pts[0], pts[1], pts[2] looks like?
if the values are close to integers (like 1.00004 or 3.9998) you can use the round function to round the values to the nearest integer like:
data = array(data, 'f').reshape(round(pts[2]), round(pts[1]), round(pts[0]))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…