- 积分
- 55970
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2014-11-18 12:52:57
|
显示全部楼层
本帖最后由 MeteoInfo 于 2014-11-18 12:54 编辑
通常卫星数据无论是什么投影,数据在该投影中的坐标是等间隔的,也就是格点数据。只有在等经纬度投影中坐标的单位才是度,其它投影中的坐标单位通常是米。所以想要定位Geostationary投影下的数据,需要知道投影参数及该投影下数据坐标的起始点、x/y方向上的格距和格点数,也就是脚本程序中的xmin, ymin, xdelt, ydelt, xnum, ynum。遗憾的是FY2E的hdf数据中并没有给出这样的信息(xnum和ynum是有的2288),好在通过调试也能大概给出(脚本中的值)。你说的经纬度数据在这里用不上。micaps正确打开该数据应该是软件里给出了此类数据的固定参数。其实如果FY系列的hdf数据遵循EOS约定就好办了,hdf格式本身保罗万象,不遵循某一约定的话无法用软件自动读取定位。
首先下载MeteoInfo Java最新版本。要生成1楼帖子里第一张图,先将地图投影成数据的投影(“显示 -> 投影”菜单),具体参考第二张图上的参数。然后运行下面的脚本程序即可。这个脚本和1楼帖子里的基本一样,只是无需再进行投影转换。
- #-----------------------------------------------------
- # Author: Yaqiang Wang
- # Date: 2014-11-16
- # Purpose: Read FY2E 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.projection import ProjectionInfo
- from org.meteoinfo.projection import KnownCoordinateSystems
- 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()
- projInfo = ProjectionInfo("+proj=geos +lon_0=104.5 +h=35785864")
- #Read hdf data file
- #fn = dataDir + 'FY2E_CTA_MLT_NOM_20141116_0200.hdf'
- fn = dataDir + 'FY2E_FDI_ALL_NOM_20110713_0100.hdf'
- if os.path.isfile(fn):
- print fn
- mdi.openNetCDFData(fn)
- dataInfo = mdi.getDataInfo()
- print mdi.getInfoText()
- xmin = -5750000.0
- ymin = -5750000.0
- xnum = 2288
- ynum = 2288
- xmax = 5750000.0
- ymax = 5750000.0
- xdelt = (xmax - xmin) / xnum
- ydelt = (ymax - ymin) / ynum
- xlist = []
- ylist = []
- for i in range(0,xnum):
- xlist.append(xmin + xdelt * i)
- for i in range(0,ynum):
- ylist.append(ymin + ydelt * 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('FY2E_CLM_Hourly_Cloud_Amount')
- var = dataInfo.getVariable('NOMChannelVIS')
- dimList = [yDim, xDim]
- var.setDimensions(dimList)
- print 'Get grid data...'
- gData = mdi.getGridData(var.getName())
- gData.yReverse()
- gData.projInfo = projInfo
- #gData.missingValue = 0.0
- print 'Reproject grid data to Lon/Lat...'
- toProj = KnownCoordinateSystems.geographic.world.WGS1984
- #gData = gData.project(toProj)
- print 'Ouput grid data to Sufer ASCII grid data file...'
- outfn = 'D:/Temp/test/NOMChannelVIS.grd'
- #gData.saveAsSurferASCIIFile(outfn)
- print 'Create raster layer from the grid data...'
- aLS = LegendManage.createLegendSchemeFromGridData(gData, LegendType.GraduatedColor, ShapeTypes.Polygon)
- aLayer = DrawMeteoData.createRasterLayer(gData, "Test_FY2E", aLS)
- #aLayer = DrawMeteoData.createShadedLayer(gData, aLS, 'Test_HDF_Shaded', 'AOD', True)
- #aLayer.setProjInfo(toProj)
- aLayer.setProjInfo(projInfo)
- print 'Add the layer...'
- mf = miapp.getMapDocument().getActiveMapFrame()
- mf.addLayer(aLayer)
- mf.moveLayer(aLayer, 0)
- print 'Finished!'
|
|