I'm having an issue with python not liking values with decimals. I believe that it wants the numbers in whole number format, not decimal...
Error:
Traceback (most recent call last):
File "plotpoints.py", line 29, in <module>
data = np.loadtxt('/home/weather/data/mos/full_highs_00z', delimiter=',', skiprows=1)
File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 848, in loadtxt
items = [conv(val) for (conv, val) in zip(converters, vals)]
ValueError: could not convert string to float:
Code:
data = np.loadtxt('/home/weather/data/mos/full_highs_00z', delimiter=',', skiprows=1)
grid_x, grid_y = np.mgrid[-85:64:dx, 34:49:dx]
grid_z = griddata((data[:,1],data[:,0]), data[:,2], (grid_x,grid_y), method='cubic')
Contents of full_highs_00z:
latitude,longitude,value
42.88355,-76.78116,81
37.1417,-79.0164,0
36.65408,-83.21783,90
41.00928,-74.73628,89.94
42.29133,-73.71033,0
43.77714,-71.75598,88
44.41944,-72.01944,86.24
Since the third column in full_highs_00z contains the values with decimals, I have a hunch that "data[:,2]" is the code that is having issues with the data being decimal and not whole numbers.
答案 0 :(得分:0)
结果发现有些字段缺少数据,所以只使用了
sed -i '/,0/d' /home/weather/data/mos/full_highs_00z
删除其中包含零的行!