- 积分
- 5634
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-1-9
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
小白求助:我参考http://bbs.06climate.com/forum.p ... &extra=page%3D2 这个帖子里的脚本,运用TXT站点数据画图,但是结果是figure窗口是一张空白的图
脚本:
#Get file names
fn = 'D:/mi_work/jdjsyz.txt'
ncol = numasciicol(fn)
nrow = numasciirow(fn)
a = asciiread(fn,shape=(nrow,ncol))
lon = a[:,0]
lat = a[:,1]
jdjsyz= a[:,2]
#To grid data
x = arange(75, 80, 0.5)
y = arange(37, 41, 0.5)
gtemp,gx,gy = griddata((lon, lat), jdjsyz, xi=(x, y), method='idw', radius=0.8)
#Plot
axesm()
bou1_layer = shaperead('D:/mi_work/xj.shp')
mlayer = shaperead('D:/mi_work/xj.shp')
geoshow(bou1_layer, edgecolor='lightgray')
geoshow(mlayer, visible=False)
levs = [0,1,2,3,4,5,6,7,8,10]
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,20)
layer = contourfm(x, y, gtemp,levs,colors=cols)
#slayer = scatterm(lon, lat,jdjsyz,colors=['k'], size=10)
slayer = scatterm(lon, lat,jdjsyz,levs,colors=cols, size=8)
masklayer(mlayer, [layer])
xlim(75, 80)
ylim(37, 41)
colorbar(layer)
运行结果:
run script...
TXT数据:
75.4 40.52 7.9
76.17 39.72 7.863
75.25 39.72 9.29
76.78 39.5 6.7
75.95 39.15 6.82
75.75 39.49 6.3
……
求各位大神指点~~
|
|