登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 MeteoInfo 于 2013-10-31 13:11 编辑
FY3B火点数据是HDF5格式,用了一个2维数据变量来表示火点,用HDFView打开数据如下:
由于数据本身的自描述信息比较缺乏,目前也没有该数据的详细说明,只能从数据本身猜测第3列和第4列分别为火点的纬度和经度。基于上述猜测写了一个脚本来读取火点数据并绘制分布图。
脚本代码:
- #-----------------------------------------------------
- # Author: Yaqiang Wang
- # Date: 2013-10-30
- # Purpose: Read FY3B fire point hdf5 data
- # Note: Sample
- #-----------------------------------------------------
- from org.meteoinfo.data.meteodata import MeteoDataInfo
- from org.meteoinfo.data.meteodata import Dimension
- from org.meteoinfo.data.meteodata import DimensionType
- from org.meteoinfo.data.meteodata import DrawMeteoData
- from org.meteoinfo.data import StationData
- from org.meteoinfo.projection import ProjectionInfo
- from org.meteoinfo.legend import LegendManage
- from org.meteoinfo.legend import LegendType
- from org.meteoinfo.shape import ShapeTypes
- import os.path
- import jarray
- #Set data directory
- dataDir = 'D:/Temp/hdf/'
- #Create MeteoDataInfo object
- mdi = MeteoDataInfo()
- #Read hdf data file
- fn = dataDir + 'FY3B_VIRRX_GBAL_L2_GFR_MLT_GLL_20130529_POAD_1000M_MS.HDF'
- if os.path.isfile(fn):
- print fn
- mdi.openNetCDFData(fn)
- dataInfo = mdi.getDataInfo()
- print mdi.getInfoText()
- xnum = 9
- ynum = 8338
- xlist = []
- ylist = []
- for i in range(0,xnum):
- xlist.append(i)
- for i in range(0,ynum):
- ylist.append(i)
- X = jarray.array(xlist, 'd')
- Y = jarray.array(ylist, 'd')
- xDim = Dimension(DimensionType.X)
- xDim.setValues(X)
- dataInfo.setXDimension(xDim)
- yDim = Dimension(DimensionType.Y)
- yDim.setValues(Y)
- dataInfo.setYDimension(yDim)
- var = dataInfo.getVariable('FIRES')
- dimList = [yDim, xDim]
- var.setDimensions(dimList)
- gData = mdi.getGridData(var.getName())
- sData = StationData()
- for d in range(0,ynum):
- stid = str(d + 1)
- lat = gData.data[d][3]
- lon = gData.data[d][4]
- value = gData.data[d][5]
- sData.addData(stid, lon, lat, value)
-
- aLS = LegendManage.createLegendSchemeFromStationData(sData, LegendType.GraduatedColor, ShapeTypes.Point)
- aLayer = DrawMeteoData.createSTPointLayer(sData, aLS, 'FY3B_Fire', 'Fire')
- #aLayer.setProjInfo(dataInfo.getProjectionInfo())
- mf = miapp.getMapDocument().getActiveMapFrame()
- mf.addLayer(aLayer)
- #mf.moveLayer(aLayer, 0)
- print 'Finished!'
|