- 积分
- 720
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-12-29
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2022-1-17 23:36:00
|
显示全部楼层
#Get file names
fn = 'f:/t/7.txt'
stfn = 'f:/t/sy.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(100.0, 104.0, 0.2)
y = arange(25.0,29.4, 0.2)
gtemp,gx,gy = griddata((lon, lat), pm, xi=(x, y), method='idw', radius=0.8)
#Plot
axesm()
bou1_layer = shaperead('D:/MeteoInfo_2.1.4/MeteoInfo/map/11212.shp')
mlayer = shaperead('D:/MeteoInfo_2.1.4/MeteoInfo/map/11212.shp')
geoshow(bou1_layer, edgecolor='lightgray')
geoshow(mlayer, visible=False)
levs = [0, 5, 10, 15, 20, 25, 30, 35, 40,45]
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,pm,colors=['k'], size=10)
slayer = scatterm(lon, lat,pm,levs,colors=cols, size=3)
layer.addfield('Name', 'string', stnames)
layer.addlabels('Name', fontname=u'楷体', fontsize=14, yoffset=15)
masklayer(mlayer, [layer])
xlim(100.0, 104.0)
ylim(26.0, 29.4)
title(u'浓度',fontname=u'黑体',fontsize=20,bold=False,color='blue')
colorbar(layer) |
|