气象水文科研猫公众号交流邮箱:leolovehydrometeor@hotmail.com欢迎投稿&批评指正如有侵权且本公众号未能正确引用原文,请联系删除,谢谢理解、谢谢配合。
犹记得研三那年,中山大学某博士建议我弃用Matlab,转战R语言和Python。故本文将对Matlab的地图白化绝口不提,毕竟当年我真的没搞明白如何利用m_map工具箱。
1 我的m_map学习成果:
注:我未能学到精髓,不敢班门弄斧耍大刀。
2 MeteoInfo的idw插值:
注:MeteoInfo的Kriging模块尚未添加。
fn = 'F:/RMeteoInfo/data/AQI3.txt'ncol = numasciicol(fn)nrow = numasciirow(fn)a = asciiread(fn,shape=(nrow,ncol))lon = a[:,0]lat = a[:,1]pm= a[:,2]x = arange(113, 120, 0.05)y = arange(36, 43, 0.05)gtemp,gx,gy = griddata((lon, lat), pm, xi=(x, y), method='idw', radius=1.6)#Plotaxesm()bou1_layer = shaperead('F:/Rpeng/31/data3/bound/bound.shp')mlayer = shaperead('F:/Rpeng/31/data3/bound/bound.shp')geoshow(bou1_layer, edgecolor='lightgray')geoshow(mlayer, visible=False)levs = [0, 25, 35, 50, 75, 95, 115, 130, 150,200]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,levs,colors=cols)slayer = scatterm(lon, lat,pm,levs,colors=cols, size=8)masklayer(mlayer, [layer])xlim(113, 120)ylim(36, 43) colorbar(layer, orientation='horizontal',ticklen=0,extendrect=False, shrink=1, aspect=30)yaxis(tickvisible=False,location='right')xaxis(tickvisible=False,location='top') savefig('F:/RMeteoInfo/plot34.png', dpi=600)