- 积分
- 934
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-7-17
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
meteoinfolab的代码如下:
#Get file names
fn = 'e:/1/1.txt'
stfn = 'e:/1/station.csv'
ncol = numasciicol(fn)
nrow = numasciirow(fn)
a = asciiread(fn,shape=(nrow,ncol))
lon = a[:,0]
lat = a[:,1]
pm= a[:,2]
#Read station name and lon/lat
table = readtable(stfn, format='%i%2s%2f')
stnames = table['Name']
#To grid data
x = arange(96, 111, 0.01)
y = arange(21, 35, 0.01)
gtemp,gx,gy = griddata((lon, lat), pm, xi=(x, y), method='idw', radius=2.3)
#Plot
axesm()
bou1_layer = shaperead('e:/MeteoInfo/map/xinan.shp')
mlayer = shaperead('e:/MeteoInfo/map/xinan.shp')
geoshow(bou1_layer, edgecolor='lightgray')
geoshow(mlayer, visible=False)
levs = [100, 200, 300,400, 500, 600, 700, 800, 900,1000]
cols = [(255,255,255),(0,255,0),(127,255,0),(255,255,0),(255,215,0),(255,128,0),(255,97,0), (255,0,0),(176,23,31),(135,38,87),(255,0,255)]
layer = contourfm(x, y, gtemp,levs,colors=cols)
slayer = scatterm(lon, lat,pm,levs,colors=cols, size=8)
layer.addfield('Name', 'string', stnames)
layer.addlabels('Name', fontname=u'楷体', fontsize=14, yoffset=15)
masklayer(mlayer, [layer])
xlim(96, 110.99)
ylim(21, 34.99)
title(u'(a)',fontname=u'黑体',fontsize=20,bold=False,color='black')
colorbar(layer)
savefig('e:/1/1.png', 800, 800)
meteoinfo报错如下:
1.txt分布如下:分别为经度,纬度,降水资料
102.97 33.57 328.3824561
98.55 31.73 374.0964912
100 31.62 344.8596491
101.1 30.98 350.4736842
102.22 31.9 387.054386
station.csv分布如下:
若尔盖
德格
甘孜
道孚
马尔康
如果不添加红色代码是正确能出图的,但是加了站名的文件就读不出来,请问谁能指导下这应该怎么改?
|
-
meteoinfo运行结果
|