- 积分
- 288
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-10-26
- 最后登录
- 1970-1-1
|
发表于 2017-8-25 15:48:31
|
显示全部楼层
王老师,我运行了如下:
#Open station file as table data
stdata = readtable('F:/MeteoInfo/sample/LonLatStation/Stations.csv', delimiter=',', format='%s%f%f')
x = stdata['Longitude']
y = stdata['Latitude']
#Add data file
f = addfile('F:/MeteoInfo/sample/GrADS/taifenggrd.ctl')
#Get data variable
psv = f['UGRD10m']
#Get time dimension length
tn = psv.dimlen(0)
#Loop
for i in range(0, tn):
#Get dimension array
ps = psv[i,'10:50','90:140']
#Interpolate to stations
ps_st = ps.tostation(x, y)
#Add column to table data
colname = 'UGRD10m' + str(i)
stdata.addcoldata(colname, '%d', ps_st)
#Save table data to a file
fn = 'f:/test_st.csv'
stdata.savefile(fn)
print 'Finish...'
提示错误为:
run script...
Traceback (most recent call last):
File "<iostream>", line 6, in <module>
File "F:\MeteoInfo\pylib\mipylib\dataset\midata.py", line 102, in addfile
return addfile_grads(fname, False)
File "F:\MeteoInfo\pylib\mipylib\dataset\midata.py", line 152, in addfile_grads
meteodata.openGrADSData(fname)
at org.meteoinfo.data.meteodata.grads.GrADSDataInfo.readDataInfo(GrADSDataInfo.java:841)
at org.meteoinfo.data.meteodata.grads.GrADSDataInfo.readDataInfo(GrADSDataInfo.java:295)
at org.meteoinfo.data.meteodata.MeteoDataInfo.openGrADSData(MeteoDataInfo.java:489)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
java.lang.ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException: 1 |
|