scipy を使用して netcdf ファイルを書き込もうとしています。scipy の Web サイトから例をコピーしましたが、出力を見ると、奇妙な数字が表示されます。
私はこれを他のことにも試しており、「float32」として宣言した別の変数に .astype(np.float32) を指定することさえありました。
Python コード:
import numpy as np
from pylab import *
from scipy.io import netcdf
f = netcdf.netcdf_file('simple.nc', 'w')
f.history = 'Created for a test'
f.createDimension('time', 10)
time = f.createVariable('time', 'i', ('time',))
time[:] = np.arange(10)
time.units = 'days since 2008-01-01'
f.close()
出力:
ncdump -v time simple.nc
netcdf simple {
dimensions:
time = 10 ;
variables:
int time(time) ;
time:units = "days since 2008-01-01" ;
// global attributes:
:history = "Created for a test" ;
data:
time = 0, 16777216, 33554432, 50331648, 67108864, 83886080, 100663296,
117440512, 134217728, 150994944 ;
}