- 积分
- 55941
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
看到Aires发的用hdfview画全球水色分布图的帖子(http://bbs.06climate.com/forum.php?mod=viewthread&tid=10426&extra=&page=1),也尝试用MeteoInfo Java版做了一下。数据:S19972441997273.L3m_MO_CHL_chlor_a_9km,下载地址:http://oceandata.sci.gsfc.nasa.gov/SeaWiFS/Mapped/Monthly/9km/chlor/ 。
数据是HDF4格式,没有遵循EOS规范,因此MeteoInfo Java版不能自动读取格点位置信息,不过用软件打开文件后可以查看文件信息:
File Name: D:\Temp\Hdf\S19972441997273.L3m_MO_CHL_chlor_a_9km
File type: Hierarchical Data Format, version 4 (HDF4)
Dimensions: 2
fakeDim0 = 2160;
fakeDim1 = 4320;
Global Attributes: [Product_Name = "S19972441997273.L3m_MO_CHL_chlor_a_9km", Sensor_Name = "SeaWiFS", Sensor = "Sea-viewing Wide Field-of-view Sensor (SeaWiFS)", Title = "SeaWiFS Level-3 Standard Mapped Image", Data_Center = "NASA/GSFC SeaWiFS Data Processing Center", Station_Name = "Wallops Flight Facility", Station_Latitude = 37.9272f, Station_Longitude = -75.4753f, Mission = "SeaStar SeaWiFS", Mission_Characteristics = "Nominal orbit: inclination = 98.2 (Sun-synchronous); node = 12 noon local (descending); eccentricity = <0.002; altitude = 705 km; ground speed = 6.75 km/sec", Sensor_Characteristics = "Number of bands = 8; number of active bands = 8; wavelengths per band (nm) = 412, 443, 490, 510, 555, 670, 765, 865; bits per pixel = 10; instantaneous field-of-view = 1.5835 mrad; pixels per scan = 1285; scan rate = 6/sec; sample rate = 7710/sec", Product_Type = "other", Processing_Version = "2010.0", Software_Name = "smigen", Software_Version = "4.17", Processing_Time = "2010272172320000", Input_Files = "S19972441997273.L3b_MO_CHL.main", Processing_Control = "smigen par=S19972441997273.L3m_MO_CHL_chlor_a_9km.param", Input_Parameters = "IFILE = /data4/sdpsoper/vdc/vpu3/workbuf/S19972441997273.L3b_MO_CHL.main|OFILE = S19972441997273.L3m_MO_CHL_chlor_a_9km|PFILE = |PROD = chlor_a|PALFILE = DEFAULT|PROCESSING VERSION = 2010.0|MEAS = 1|STYPE = 0|DATAMIN = 0.000000|DATAMAX = 0.000000|LONWEST = -180.000000|LONEAST = 180.000000|LATSOUTH = -90.000000|LATNORTH = 90.000000|RESOLUTION = 9km|PROJECTION = RECT|GAP_FILL = 0|SEAM_LON = -180.000000|PRECISION=F", L2_Flag_Names = "ATMFAIL,LAND,HILT,HISATZEN,STRAYLIGHT,CLDICE,COCCOLITH,LOWLW,CHLWARN,CHLFAIL,NAVWARN,MAXAERITER,ATMWARN,HISOLZEN,NAVFAIL,FILTER,HIGLINT", Period_Start_Year = 1997S, Period_Start_Day = 247S, Period_End_Year = 1997S, Period_End_Day = 273S, Start_Time = "1997247162633871", End_Time = "1997274055157036", Start_Year = 1997S, Start_Day = 247S, Start_Millisec = 59193871, End_Year = 1997S, End_Day = 274S, End_Millisec = 21117036, Start_Orbit = 519, End_Orbit = 905, Orbit = 712, Map_Projection = "Equidistant Cylindrical", Latitude_Units = "degrees North", Longitude_Units = "degrees East", Northernmost_Latitude = 90.0f, Southernmost_Latitude = -90.0f, Westernmost_Longitude = -180.0f, Easternmost_Longitude = 180.0f, Latitude_Step = 0.083333336f, Longitude_Step = 0.083333336f, SW_Point_Latitude = -89.958336f, SW_Point_Longitude = -179.95833f, Data_Bins = 2750226, Number_of_Lines = 2160, Number_of_Columns = 4320, Parameter = "Chlorophyll a concentration", Measure = "Mean", Units = "mg m^-3", Scaling = "linear", Scaling_Equation = "(Slope*l3m_data) + Intercept = Parameter value", Slope = 1.0f, Intercept = 0.0f, Data_Minimum = 0.00149f, Data_Maximum = 97.93204f, Suggested_Image_Scaling_Minimum = 0.01f, Suggested_Image_Scaling_Maximum = 20.0f, Suggested_Image_Scaling_Type = "LOG", Suggested_Image_Scaling_Applied = "No", _History = "Direct read of HDF4 file through CDM library", HDF4_Version = "4.2.5 (HDF Version 4.2 Release 5, February 17, 2010)"]
: Product_Name = "S19972441997273.L3m_MO_CHL_chlor_a_9km"
: Sensor_Name = "SeaWiFS"
: Sensor = "Sea-viewing Wide Field-of-view Sensor (SeaWiFS)"
: Title = "SeaWiFS Level-3 Standard Mapped Image"
: Data_Center = "NASA/GSFC SeaWiFS Data Processing Center"
: Station_Name = "Wallops Flight Facility"
: Station_Latitude = 37.9272f
: Station_Longitude = -75.4753f
: Mission = "SeaStar SeaWiFS"
: Mission_Characteristics = "Nominal orbit: inclination = 98.2 (Sun-synchronous); node = 12 noon local (descending); eccentricity = <0.002; altitude = 705 km; ground speed = 6.75 km/sec"
: Sensor_Characteristics = "Number of bands = 8; number of active bands = 8; wavelengths per band (nm) = 412, 443, 490, 510, 555, 670, 765, 865; bits per pixel = 10; instantaneous field-of-view = 1.5835 mrad; pixels per scan = 1285; scan rate = 6/sec; sample rate = 7710/sec"
: Product_Type = "other"
: Processing_Version = "2010.0"
: Software_Name = "smigen"
: Software_Version = "4.17"
: Processing_Time = "2010272172320000"
: Input_Files = "S19972441997273.L3b_MO_CHL.main"
: Processing_Control = "smigen par=S19972441997273.L3m_MO_CHL_chlor_a_9km.param"
: Input_Parameters = "IFILE = /data4/sdpsoper/vdc/vpu3/workbuf/S19972441997273.L3b_MO_CHL.main|OFILE = S19972441997273.L3m_MO_CHL_chlor_a_9km|PFILE = |PROD = chlor_a|PALFILE = DEFAULT|PROCESSING VERSION = 2010.0|MEAS = 1|STYPE = 0|DATAMIN = 0.000000|DATAMAX = 0.000000|LONWEST = -180.000000|LONEAST = 180.000000|LATSOUTH = -90.000000|LATNORTH = 90.000000|RESOLUTION = 9km|PROJECTION = RECT|GAP_FILL = 0|SEAM_LON = -180.000000|PRECISION=F"
: L2_Flag_Names = "ATMFAIL,LAND,HILT,HISATZEN,STRAYLIGHT,CLDICE,COCCOLITH,LOWLW,CHLWARN,CHLFAIL,NAVWARN,MAXAERITER,ATMWARN,HISOLZEN,NAVFAIL,FILTER,HIGLINT"
: Period_Start_Year = 1997S
: Period_Start_Day = 247S
: Period_End_Year = 1997S
: Period_End_Day = 273S
: Start_Time = "1997247162633871"
: End_Time = "1997274055157036"
: Start_Year = 1997S
: Start_Day = 247S
: Start_Millisec = 59193871
: End_Year = 1997S
: End_Day = 274S
: End_Millisec = 21117036
: Start_Orbit = 519
: End_Orbit = 905
: Orbit = 712
: Map_Projection = "Equidistant Cylindrical"
: Latitude_Units = "degrees North"
: Longitude_Units = "degrees East"
: Northernmost_Latitude = 90.0f
: Southernmost_Latitude = -90.0f
: Westernmost_Longitude = -180.0f
: Easternmost_Longitude = 180.0f
: Latitude_Step = 0.083333336f
: Longitude_Step = 0.083333336f
: SW_Point_Latitude = -89.958336f
: SW_Point_Longitude = -179.95833f
: Data_Bins = 2750226
: Number_of_Lines = 2160
: Number_of_Columns = 4320
: Parameter = "Chlorophyll a concentration"
: Measure = "Mean"
: Units = "mg m^-3"
: Scaling = "linear"
: Scaling_Equation = "(Slope*l3m_data) + Intercept = Parameter value"
: Slope = 1.0f
: Intercept = 0.0f
: Data_Minimum = 0.00149f
: Data_Maximum = 97.93204f
: Suggested_Image_Scaling_Minimum = 0.01f
: Suggested_Image_Scaling_Maximum = 20.0f
: Suggested_Image_Scaling_Type = "LOG"
: Suggested_Image_Scaling_Applied = "No"
: _History = "Direct read of HDF4 file through CDM library"
: HDF4_Version = "4.2.5 (HDF Version 4.2 Release 5, February 17, 2010)"
Variations: 1
float l3m_data(fakeDim0,fakeDim1);
l3m_data: Fill = -32767.0f
l3m_data: Scaling = "linear"
l3m_data: Scaling_Equation = "(Slope*l3m_data) + Intercept = Parameter value"
l3m_data: Slope = 1.0f
l3m_data: Intercept = 0.0f
文件信息里有格点投影、起始经纬度、经纬度间隔等信息,利用这些信息在MeteoInfo的脚本编辑器中写一个Jython脚本即可正确打开数据并生成数据图层。修改图例后显示如下:
脚本代码:
- #-----------------------------------------------------
- # Author: Yaqiang Wang
- # Date: 2013-10-29
- # Purpose: Read hdf4 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.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 + 'S19972441997273.L3m_MO_CHL_chlor_a_9km'
- if os.path.isfile(fn):
- print fn
- mdi.openNetCDFData(fn)
- dataInfo = mdi.getDataInfo()
- print mdi.getInfoText()
- xmin = -180.0
- ymin = -90.0
- xnum = 4320
- ynum = 2160
- xdelt = 0.083333336
- ydelt = 0.083333336
- 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('l3m_data')
- dimList = [yDim, xDim]
- var.setDimensions(dimList)
- gData = mdi.getGridData(var.getName())
- gData.yReverse()
- gData.missingValue = -32767.0
- aLS = LegendManage.createLegendSchemeFromGridData(gData, LegendType.GraduatedColor, ShapeTypes.Polygon)
- aLayer = DrawMeteoData.createRasterLayer(gData, "Test_HDF", aLS)
- aLayer.setProjInfo(dataInfo.getProjectionInfo())
- mf = miapp.getMapDocument().getActiveMapFrame()
- mf.addLayer(aLayer)
- mf.moveLayer(aLayer, 0)
- print 'Finished!'
|
评分
-
查看全部评分
|