- 积分
- 55960
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
主要是一些功能的完善和bug修正。
应HYSPLIT论坛上一些用户的需求,增加了下列功能:
给MeteoDataInfo类增加了getArrivalTimeData(String varName, double threshold)方法用了获取变量达到某个临界值所需的时间(距起始时间的小时数),两个参数分别是变量名和临界值。目前只能用于脚本,以后再看有没有必要加入GUI界面中。示例脚本程序:
- #-----------------------------------------------------
- # Author: Yaqiang Wang
- # Date: 2014-5-3
- # Purpose: Get time of arrival data and plot
- # Note: Sample
- #-----------------------------------------------------
- print 'Loading classes...'
- from org.meteoinfo.plot import MapLayoutPlot
- from org.meteoinfo.data import GridData
- from org.meteoinfo.data.meteodata import MeteoDataInfo
- from org.meteoinfo.data.meteodata import DrawMeteoData
- from org.meteoinfo.legend import LegendScheme
- from org.meteoinfo.legend import LegendManage
- from org.meteoinfo.legend import LegendType
- from org.meteoinfo.shape import ShapeTypes
- import os.path
- #Set directory
- dataDir = 'D:/Temp/HYSPLIT'
- infn = os.path.join(dataDir, 'HYSPLIT_cdump')
- #Open data
- print 'Open data...'
- mdi = MeteoDataInfo()
- mdi.openHYSPLITConcData(infn)
- tData = mdi.getArrivalTimeData('DUST', 0.001)
- #Plot data
- print 'Plot data...'
- aLS = LegendManage.createLegendSchemeFromGridData(tData, LegendType.GraduatedColor, ShapeTypes.Polygon)
- #aLayer = DrawMeteoData.createShadedLayer(tData, aLS, 'TimeOfArrial_DUST', 'Hour', True)
- aLayer = DrawMeteoData.createRasterLayer(tData, 'TimeOfArrial_DUST', aLS)
- aLayer.setProjInfo(mdi.getProjectionInfo())
- mf = miapp.getMapDocument().getActiveMapFrame()
- mf.addLayer(aLayer)
- mf.moveLayer(aLayer, 0)
- miapp.getMapDocument().getMapLayout().paintGraphics()
- print 'Finished'
给MeteoDataInfo类增加了toStation方法,有几个重载,用来获取任意时空轨迹上的气象数据(线性差值)。示例脚本程序:
- #-----------------------------------------------------
- # Author: Yaqiang Wang
- # Date: 2014-5-4
- # Purpose: Get meteorological data along trajectory
- # Note: Sample
- #-----------------------------------------------------
- import os
- from org.meteoinfo.data.meteodata import MeteoDataInfo
- from org.meteoinfo.global.table import DataTypes
- from java.text import SimpleDateFormat
- # Set working directory
- trajDir = 'D:/Trajectory/bj'
- meteoDir = 'P:/MetData/MetData/2011'
- # Open trjactory data file
- print 'Open trajectory data file ...'
- # Create a MeteoDataInfo object
- mdi_traj = MeteoDataInfo()
- # Open trajectory data file
- trajFile = '11033120'
- trajfn = os.path.join(trajDir, trajFile)
- print 'Trajectory file: ' + trajfn
- mdi_traj.openHYSPLITTrajData(trajfn)
- # Create trajectory layer
- trajLayer = mdi_traj.getDataInfo().createTrajPointLayer()
- trajLayer.setLayerName('Trajectorie' + '_' + trajFile)
- # Open meteorological data file
- print 'Open meteorological data file...'
- # Create a MeteoDataInfo object
- mdi_meteo = MeteoDataInfo()
- # Open meteorological data file
- meteoFile = 'gdas1.mar11.w5'
- meteofn = os.path.join(meteoDir, meteoFile)
- print 'Meteorological file: ' + meteofn
- mdi_meteo.openARLData(meteofn)
- # Get meteorological data along trajectory
- print 'Get meteorological data along trajectory...'
- varName = 'UWND'
- trajLayer.editAddField(varName, DataTypes.Float)
- dformat = SimpleDateFormat('yyyyMMddHH')
- idx = 0
- for ps in trajLayer.getShapes():
- lon = ps.getPoint().X
- lat = ps.getPoint().Y
- pres = trajLayer.getCellValue('Pressure', idx)
- t = dformat.parse(trajLayer.getCellValue('Date', idx))
- v = mdi_meteo.toStation(varName, lon, lat, pres, t)
- trajLayer.editCellValue(varName, idx, v)
- idx += 1
- # Add the layer into the MeteoInfo application (miapp)
- print 'Add trajectory layer...'
- mf = miapp.getMapDocument().getActiveMapFrame()
- mf.addLayer(trajLayer)
- print 'Finish...'
|
|