- 积分
- 528
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-4-19
- 最后登录
- 1970-1-1

|
发表于 2022-5-6 16:25:03
|
显示全部楼层
fn = 'C:/Users/ybsky/Desktop/porject1/rain.txt'
ncol = numasciicol(fn)
nrow = numasciirow(fn)
a = asciiread(fn,shape=(nrow,ncol))
lon = a[:,0]
lat = a[:,1]
t = a[:,2]
#To grid data
x = arange(104, 106.7, 0.2)
y = arange(32.5, 34.7, 0.2)
gtemp,gx,gy = griddata((lon, lat), t, xi=(x, y), method='idw', radius=0.1)
#Plot
axesm()
geoshow('ln',edgecolor='lightgray')
levs = [0, 5, 10, 15, 20, 25, 35, 40, 45,50]
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,t,colors=['k'], size=10)
slayer = scatterm(lon, lat, t,levs,colors=cols, size=8)
masklayer(mlayer, [layer])
xlim(104, 106.7)
ylim(32.5, 34.7)
title(u'陇南暴雨频次',fontname=u'黑体',fontsize=20,bold=False,color='blue')
#text(113.3, 23.9, u'2017年5月6日13时', fontname=u'黑体', fontsize=16)
colorbar(layer)
代码正常运行
34.26 104.18 7
33.81 105.12 8
32.90 104.81 6
33.72 105.54 17
33.76 105.80 29
33.86 105.69 22
33.99 105.34 12
33.98 105.31 5
32.78 105.38 48
32.84 104.99 6
34.29 104.15 7
33.34 105.67 34
32.95 104.67 12
32.98 105.25 25
33.30 105.46 28
33.43 104.82 10
32.98 105.08 9
34.03 105.30 6
这是数据,为啥出图了只有地图,没有数据 |
-
|