登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 MeteoInfo 于 2015-5-23 22:29 编辑
圆盘标称投影数据时静止气象卫星常见的数据产品,比如FY2E静止气象卫星就有很多这样的产品(可以从国家卫星气象中心网站上下载)。所谓的圆盘标称投影就是Geostationary投影,主要的投影参数有中央经度和卫星高度。这里给出一个示例脚本程序可以读取FY2E HDF格式数据、将数据投影为等经纬度并生成数据图层。需要最新的MeteoInfo Java版本(MeteoInfo Java 1.1.6R1,http://www.meteothinker.com)。
FY2E的HDF数据自描述得很粗糙,数据的范围(脚本中的xmin等)是自己调试出来的,如果有人知道确切的数据也请指出。
脚本程序:
- #-----------------------------------------------------# 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!'
数据本身投影的图层:
投影为等经纬度数据:
|