- 积分
- 55953
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
发表于 2016-9-6 22:46:13
|
显示全部楼层
参考此脚本:
- #Set data folders
- obsdir = 'U:/data/micaps'
- mapdir = 'T:/verification/map'
- outdir = 'C:/Temp/test'
- #Set time
- st = datetime.datetime(2015,11,1,0)
- sbjt = st + datetime.timedelta(hours=8)
- #Plot
- figure(figsize=[768,480], newfig=False)
- axesm(position=[0,0,1,1], xyscale=1.2, tickfontsize=12)
- lworld = shaperead(os.path.join(mapdir, 'country1.shp'))
- lchina = shaperead(os.path.join(mapdir, 'bou2_4p.shp'))
- geoshow(lchina)
- geoshow(lworld, edgecolor='k')
- #Set weather list - haze, mist and fog
- weathers = [5,10,11,12,40,41,42,43,44,45,46,47,48,49]
- ls = weatherspec(weathers)
- #Add south China Sea
- lscs = shaperead(os.path.join(mapdir, 'bou1_4l.shp'))
- axesm(position=[0.76,0.09,0.16,0.22], axison=False, xyscale=1.2)
- geoshow(lscs, facecolor=(0,0,255))
- xlim(106, 123)
- ylim(2, 23)
- #Set current plot to 1
- currentplot(1)
- #Create gif animation
- giffn = os.path.join(outdir, 'V_vis_' + st.strftime('%Y%m%d') + '--loop-.gif')
- print giffn
- animation = gifanimation(giffn)
- #Loop
- nn = 0
- bjt = sbjt
- for t in range(1, 25):
- if nn > 0:
- cll()
- bjt = bjt + datetime.timedelta(hours=3)
- obsfn = os.path.join(obsdir, str(bjt.year) + '/plot/' + bjt.strftime('%y%m%d%H.000'))
- if os.path.exists(obsfn):
- print 'Observation data file: ' + obsfn
- obsf = addfile_micaps(obsfn)
- odata = obsf.stationdata('WeatherNow')
- lobs = scatterm(odata, symbolspec=ls)
- title('CUACE/Haze-Fog visibility (km) ' + sbjt.strftime('%Y-%m-%d %H:00') + \
- ' +' + str(t*3) + ' (' + bjt.strftime('%Y-%m-%d %H:00') + ')', \
- bold=False)
- xlim(68.6, 140.5)
- ylim(17.3, 54)
- #Add frame to gif animation
- gifaddframe(animation)
- nn += 1
- #Finish gif animation
- animation.finish()
- print 'Finished...'
|
|