MeteoInfo脚本示例:读取FY3A AOD HDF文件

FY3A卫星有AOD产品数据,HDF格式,这里示例用MeteoInfo脚本程序读取和显示该类数据。

脚本程序如下:

#-----------------------------------------------------
# Author: Yaqiang Wang
# Date: 2015-3-18
# Purpose: Read FY3A AOD 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.legend import LegendScheme
from org.meteoinfo.shape import ShapeTypes
from ucar.nc2 import NetcdfFile
import os.path
import jarray

#Set data directory
dataDir = ‘D:/Temp/Hdf‘

#Create MeteoDataInfo object
mdi = MeteoDataInfo()

#Read hdf data file
fn = os.path.join(dataDir, ‘FY3A_MERSI_GBAL_L3_ASL_MLT_GLL_20140331_AOAM_5000M_MS.HDF‘)
if os.path.isfile(fn):
    print fn
    mdi.openNetCDFData(fn)
    dataInfo = mdi.getDataInfo()
    #print mdi.getInfoText()
    xmin = -30.0
    ymin = -90.0
    xnum = 7200
    ynum = 3600
    xdelt = 0.05
    ydelt = 0.05
    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(‘Aerosol_Optical_Thickness_of_MERSI_550nm‘)
    print var.getName()
    dimList = [yDim, xDim]
    var.setDimensions(dimList)
    gData = mdi.getGridData(var.getName())
    gData.yReverse()
    gData = gData.div(10000.0)
    gData.missingValue = -3.2767
    #aLS = LegendManage.createLegendSchemeFromGridData(gData, LegendType.GraduatedColor, ShapeTypes.Polygon)
    aLS = LegendScheme(ShapeTypes.Polygon)
    aLS.importFromXMLFile(os.path.join(dataDir, ‘AOD.lgs‘))
    aLayer = DrawMeteoData.createRasterLayer(gData, "Test_HDF", aLS)
    mf = miapp.getMapDocument().getActiveMapFrame()
    mf.addLayer(aLayer)
    mf.moveLayer(aLayer, 0)

print ‘Finished!‘
时间: 2024-11-01 02:37:29

MeteoInfo脚本示例:读取FY3A AOD HDF文件的相关文章

MeteoInfoLab脚本示例:FY-3A AOD HDF数据

FY3A卫星有HDF格式的AOD产品数据,全球范围,分辨率为0.05度.读取数据文件变量后要重新设定X/Y维,数据是Y轴反向的,且需要除以10000得到AOD值. 脚本程序: #Add data file fn = 'D:/Temp/hdf/FY3A_MERSI_GBAL_L3_ASL_MLT_GLL_20140331_AOAM_5000M_MS.HDF' f = addfile(fn) #Get data variable v = f['Aerosol_Optical_Thickness_of

MeteoInfo脚本示例:Trajectory

示例读取HYSPLIT模式输出的气团轨迹数据文件,生成轨迹图层,并显示轨迹各节点的气压图. 脚本程序: f = addfile_hytraj('D:/MyProgram/Distribution/java/MeteoInfo/MeteoInfo/sample/HYSPLIT/tdump') tlayer = f.trajlayer() stlayer = f.trajsplayer() axesm(position=[0.1,0.4,0.8,0.6]) mlayer = shaperead('D

MeteoInfo脚本示例:GrADS to netCDF

这里给出一个将GrADS数据文件转为netCDF数据文件的脚本示例程序,其它格式数据转netCDF可以参考: #----------------------------------------------------- # Author: Yaqiang Wang # Date: 2015-3-12 # Purpose: Convert CUACE grads data to netCDF (CUACE/Dust) # Note: Sample #------------------------

MeteoInfoLab脚本示例:MODIS AOD

MODIS的气溶胶光学厚度(AOD)产品应用很广,数据可以在Giovanni上下载:http://disc.sci.gsfc.nasa.gov/giovanni/overview/index.html.有HDF, netCDF和文本格式,这里示例打开netCDF格式数据,提取AOD数据并绘图. 脚本程序如下: f = addfile('D:/Temp/nc/MOD08_D3.A2015121.051.2015122103938.pscs_000500931513.Optical_Depth_La

MeteoInfoLab脚本示例:OMI Swath HDF数据

这个例子读取OMI卫星Swath数据中的CloudFaction变量并绘图. 脚本程序: #Add data file folder = 'D:/Temp/hdf/' fns = 'OMI-Aura_L2-OMNO2_2008m0720t2016-o21357_v003-2008m0721t101450.he5' fn = folder + fns f = addfile(fn) lon_v = f['Longitude'] lat_v = f['Latitude'] lon = lon_v[:

MeteoInfoLab脚本示例:TRMM 2A12 HDF数据

TRMM 2A12 HDF数据是卫星观测的SWATH数据(轨道数据),比格点数据处理起来要麻烦一些.数据的经纬度保存在geolocation变量中,需要先将经纬度数据读出来(均为2维数组),然后读取云水含量数据(cldWater).虽然都是2维数组,但并不是格点数据,相当于2维的散点数据,点数相当多(3019*208)如果用散点图来绘制的话会非常的慢,需要将其插值为格点数据.插值方法建议选择nearest,该方法速度最快.插值后的格点数据用imshowm函数显示为图像就很快了. 脚本程序: #A

MeteoInfoLab脚本示例:AIRS Swath HDF数据

例子中的AIRS Swath HDF数据在Polar Stereographic(南极)投影中接近矩形,需要先从数据中读出经纬度及相关数据数组,利用surfacem函数绘制Swath数据(散点),在surfacem函数中经纬度数据会被投影到目的投影坐标系(在axesm函数中定义),并从2维散点数据生成surface数据(也就是格点数据)用所谓的surface插值方法.2维散点数据可以组成格网(非矩形格网),遍历目标格点数据的每个格点,该格点落在格网中哪个网格中,就将此网格的散点值赋给该格点.有些

MeteoInfoLab脚本示例:OMI Grid HDF数据

OMI卫星格点数据的例子,全球臭氧柱总量分布. 脚本程序: #Add data file folder = 'D:/Temp/hdf/' fns = 'OMI-Aura_L3-OMTO3e_2005m1214_v002-2006m0929t143855.he5' fn = folder + fns f = addfile(fn) vname = 'ColumnAmountO3' v = f[vname] data = v[:,:] #Plot axesm() mlayer = shaperead

Linux Shell脚本逐行读取多个文件

现有file1.file2.file3三个文件,其内容如下 $cat file1 f1_1 f1_2 f1_3 $cat file2 f2_1 f2_2 f2_3 $cat file3 f3_1 f3_2 f3_3 编写shell脚本逐行读取这三个文件 #!/bin/bash cat file1 file2 file3 |while read p   do     echo $p   done [思考] 采用done引入多个文件,怎么实现? #!/bin/bashwhile read p  do