格点插值为站点数据批量处理

可以利用脚本程序(MeteoInfoLab环境下)来批量处理格点数据插值为站点数据。示例脚本程序如下,已经注释得很清楚了,这里就不多说了。

 

脚本程序:

#Open station file as table data
stdata = readtable('D:/Temp/China_Prec_2010101420.csv', delimiter=',', format='%s%f%f')
x = stdata['Longitude']
y = stdata['Latitude']
#Add data file
f = addfile('D:/Temp/GrADS/model.ctl')
#Get data variable
psv = f['PS']
#Get time dimension length
tn = psv.dimlen(0)
#Loop
for i in range(0, tn):
    #Get dimension array
    ps = psv[i,(10,60),(60,140)]
    #Interpolate to stations
    ps_st = ps.tostation(x, y)
    #Add column to table data
    colname = 'PS' + str(i)
    stdata.addcol(colname, '%d', ps_st)

#Save table data to a file
fn = 'D:/Temp/test_st.csv'
stdata.savefile(fn)
print 'Finish...'

 

转载于:https://www.cnblogs.com/yaqiang/p/4494516.html

  • 1
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值