- 积分
- 55955
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 MeteoInfo 于 2019-7-29 16:37 编辑
在MeteoInfoLab中实现一页多图可以用subplot(http://www.meteothink.org/docs ... s/plot/subplot.html)函数,但是如果一个subplot中有两个或者以上的坐标系(axes或axesm)时就不适合用subplot了,可以用axes(或者axesm)函数的position参数来控制子图的位置。这里演示制作一个4个不同物种(BC, PM2.5, SO2, NOx)的排放源清单图,图中有(a), (b), (c), (d)四个子图,每个子图还要有南海脚图,总共有8个坐标系(axesm)。
脚本程序:
- spnames = ['BC','PM2.5','SO2','NOx']
- nns = ['(a)','(b)','(c)','(d)']
- basedir = 'D:/KeyData/PMMUL/analysis'
- mapdir = 'D:/Temp/Map'
- sectors = ['TRANSPORT','AIR','ENERGY','INDUSTRY','RESIDENTIAL','SHIPS']
- #Figure
- figure(figsize=[822, 421], newfig=False)
- lworld = shaperead(os.path.join(mapdir, 'country1.shp'))
- lchina = shaperead(os.path.join(mapdir, 'bou2_4p.shp'))
- lsts = shaperead(os.path.join(basedir, 'shape/stations-1.shp'))
- sc_layer = shaperead(os.path.join(mapdir, 'bou1_4l.shp'))
- #Loop
- pn = 1
- col = 0
- row = 0
- for spname,nn in zip(spnames, nns):
- varname = 'emi_' + spname.lower()
- print varname
- datadir = 'D:/KeyData/Emission/EDGAR_HTAP/2010/' + spname
- i = 0
- for sector in sectors:
- f = addfile(os.path.join(datadir, 'edgar_HTAP_' + spname + '_emi_' + sector + '_2010.0.1x0.1.nc'))
- bc = f[varname][[15,55],[72,137]]
- if i == 0:
- tbc = bc
- else:
- tbc = tbc + bc
- i += 1
- # Plot
- if col == 2:
- row += 1
- col = 0
- print row
- print col
- axesm(position=[0.5*col+0.01,0.5*(1-row)+0.05,0.4,0.44], tickfontname='Tahoma', tickfontsize=10)
- geoshow(lworld)
- geoshow(lchina)
- geoshow(lsts, facecolor='b', size=2, labelfield='Stations', fontname='Tahoma', fontsize=10, yoffset=12)
- levs = arange(5.0E-12, 2.0E-10, 5.0E-12)
- if spname == 'BC':
- levs = arange(1.0E-12, 4.0E-11, 1.0E-12)
- cols = makecolors(len(levs) + 1, cmap='MPL_OrRd', reverse=False)
- cols[0] = 'w'
- layer = imshowm(tbc, levs, colors=cols)
- colorbar(layer, fontname='Tahoma', fontsize=10)
- xlim(72,137)
- ylim(15,55)
- text(75, 51, nn, fontname='Arial', fontsize=12, bold=True)
- yticks(arange(20, 60, 10))
- #Add south China Sea
- axesm(position=[0.5*col+0.345-0.016*col,0.5*(1-row)+0.06,0.06,0.12], axison=False)
- geoshow(sc_layer)
- xlim(106, 123)
- ylim(2, 23)
- pn += 1
- col += 1
- #savefig(os.path.join(basedir, 'Figure/emis_2010.pdf'))
|
|