我有一个 netCDF4 数据文件,其中时间变量存储为浮点数(netCDF: 'f8', numpy: float64),我需要将其更改为 32bit int (netCDF: 'i4', numpy: int32)。我试过在 python 中进行更改
tds.variables['time'][:] = np.int32(tds.variables['time'][:])
Run Code Online (Sandbox Code Playgroud)
但这没有用。进行此更改的最佳方法是什么?