| 
 
	积分42贡献 精华在线时间 小时注册时间2016-8-31最后登录1970-1-1 
 | 
 
 发表于 2016-9-13 14:03:26
|
显示全部楼层 
| 原始数据
 经度       纬度     值
 111.36   29.58   60
 120.299 31.568  39
 120.86   32.01   45
 98         40        98
 100       50        69
 120.45   32.57   98
 119.82  32.93    63
 119.16  34.59    40
 118.83  32.36    80
 117.2    34.26    78
 
 
 程序:
 #Set data folders
 # coding=utf-8
 basedir = 'C:/Users/jingjing_gu/Desktop/MeteoInfo_Java_1.3.4R3_Files/MeteoInfo'
 datadir = os.path.join(basedir, 'sample/MICAPS')
 mapdir = os.path.join(basedir, 'map')
 #Read shape files
 bou2_layer = shaperead(os.path.join(mapdir, 'bou2_4p.shp'))
 bou1_layer = shaperead(os.path.join(mapdir, 'bou1_4l.shp'))
 china_layer = shaperead(os.path.join(mapdir, 'china.shp'))
 city_layer = shaperead(os.path.join(mapdir, 'res1_4m.shp'))
 #Read station data
 fn = 'E:/Temp/txt.dat'
 ncol = numasciicol(fn)
 nrow = numasciirow(fn)
 a = asciiread(fn,shape=(nrow,ncol))
 lon = a[:,0]
 lat = a[:,1]
 v = a[:,2]
 axesm()
 #griddata function - interpolate
 x = arange(75, 135,0.5)
 y = arange(18, 55, 0.5)
 prg = griddata((lon, lat), v, xi=(x, y),  method='idw', convexhull=True)[0]
 #Plot
 geoshow(bou2_layer, edgecolor='lightgray')
 geoshow(bou1_layer, facecolor=(0,0,255))
 geoshow(city_layer, facecolor='r', size=4, labelfield='NAME', fontname=u'楷体', fontsize=16, yoffset=15)
 geoshow(china_layer, visible=False)
 levs = [0.1, 1, 2, 5, 10, 20, 25, 50, 100]
 cols = [(255,255,255),(170,240,255),(120,230,240),(200,220,50),(240,220,20),(255,120,10),(255,90,10), \
 (240,40,0),(180,10,0),(120,10,0)]
 layer = contourfm(prg, levs, colors=cols)
 masklayer(china_layer, [layer])
 colorbar(layer)
 xlim(72, 136)
 ylim(16, 55)
 text(95, 52, u'全国PM2.5实况图', fontname=u'黑体', fontsize=16)
 text(95, 50, u'(2010-10-14 08:00 至 2010-10-14 14:00)', fontname=u'黑体', fontsize=14)
 #Add south China Sea
 sc_layer = bou1_layer.clone()
 axesm(position=[0.14,0.18,0.15,0.2], axison=False)
 geoshow(sc_layer, facecolor=(0,0,255))
 xlim(106, 123)
 ylim(2, 23)
 出的插值图感觉不合理,是不是程序中参数设置的有问题,请老师指教。
  
 
 
 | 
 
数据对应的散点图   
数据对应的插值图   |