- 积分
- 55946
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
卫星臭氧观测数据OMI Ozone Level 3 Data可以在此网站上下载:http://ozoneaq.gsfc.nasa.gov/OMIOzone.md。数据的分辨率是1度*1度或0.25度*0.25度,每天一个数据文件,文件是文本格式,这里以1度*1度的数据为例。为了更方便地处理该数据,可以将多个时次的文本数据文件合并为一个GrADS二进制文件,脚本程序如下(需要MeteoInfo最新文件,见置顶帖子):
- #--------------------------------------------------------
- # Author: Yaqiang Wang
- # Date: 2012-5-30
- # Purpose: Convert OMI ozon data to GrADS binary data
- # Note: Sample
- #-----------------------------------------------------------
- import clr
- from System import *
- clr.AddReference("MeteoInfoC.dll")
- from MeteoInfoC import *
- from MeteoInfoC.Data import *
- from MeteoInfoC.Data.MeteoData import *
- import os.path
- #---- Set data folders
- baseDir = 'F:\\Temp\\satellite\\'
- dataDir = baseDir + 'OMI_ozone_201201\\'
- #---- Set output data file
- outCtlFile = baseDir + 'omi_ozone_201201.ctl'
- outDataFile = baseDir + 'omi_ozone_201201.dat'
- #---- Set start/end time
- sTime = DateTime(2012, 1, 1)
- eTime = DateTime(2012, 1, 31)
- tNum = (eTime - sTime).Days + 1
- print 'Start time: ' + sTime.ToString("yyyy-MM-dd")
- print 'End time: ' + eTime.ToString("yyyy-MM-dd")
- print 'Time Number: ' + str(tNum)
- #---- Define and set output GrADS data info
- gDataInfo = GrADSDataInfo()
- gDataInfo.FileName = outCtlFile
- gDataInfo.DSET = outDataFile
- gDataInfo.TITLE = 'OMI Ozone data'
- gDataInfo.DTYPE = 'GRIDDED'
- gDataInfo.XDEF.Type = 'LINEAR'
- gDataInfo.XDEF.XNum = 360
- gDataInfo.XDEF.XMin = -179.5
- gDataInfo.XDEF.XDelt = 1.0
- gDataInfo.YDEF.Type = 'LINEAR'
- gDataInfo.YDEF.YNum = 180
- gDataInfo.YDEF.YMin = -89.5
- gDataInfo.YDEF.YDelt = 1.0
- gDataInfo.ZDEF.Type = 'LINEAR'
- gDataInfo.ZDEF.ZNum = 1
- gDataInfo.ZDEF.SLevel = 1
- gDataInfo.ZDEF.ZDelt = 1
- gDataInfo.TDEF.Type = 'LINEAR'
- gDataInfo.TDEF.TNum = tNum
- gDataInfo.TDEF.STime = sTime
- gDataInfo.TDEF.TDelt = '1dy'
- aVar = VAR()
- aVar.VName = 'ozone'
- aVar.LevelNum = 0
- aVar.Units = '99'
- aVar.Description = 'OMI Ozone'
- gDataInfo.VARDEF.AddVar(aVar)
- #---- Write GrADS data file
- gDataInfo.CreateDataFile(outDataFile)
- aTime = sTime
- for t in range(0, tNum):
- print aTime.ToString("yyyy-MM-dd")
- inFilePath = dataDir + 'L3_ozone_omi_' + aTime.ToString("yyyyMMdd") + '.txt'
- if os.path.isfile(inFilePath):
- print inFilePath
- #---- Read grid data form OMI Ozone data file
- gData = Array.CreateInstance(Double, 180, 360)
- dataFile = open(inFilePath)
- lineNum = 0
- dataStr = ''
- yIdx = 0
- xIdx = 0
- for aLine in dataFile.readlines():
- lineNum += 1
- if lineNum <= 3:
- continue
-
- aLine = aLine[1:]
- dataStr = dataStr + aLine
- for i in range(0, 25):
- if xIdx == 360:
- xIdx = 0
- yIdx += 1
- break
-
- dStr = aLine[i * 3:i * 3 + 3]
- if dStr == ' 0':
- gData[yIdx, xIdx] = gDataInfo.UNDEF
- else:
- gData[yIdx, xIdx] = float(dStr) / 10
- xIdx += 1
-
- dataFile.close()
- gDataInfo.WriteGridData(gData)
- else:
- gDataInfo.WriteGridData_Null()
- print 'Null'
-
- aTime = aTime.AddDays(1)
- gDataInfo.CloseDataFile()
- #---- Write GrADS control file
- gDataInfo.WriteGrADSCTLFile()
- print 'Finished...'
复制代码
转换后的GrADS二进制数据可以用MeteoInfo绘图,或用脚本进行月平均之类的统计计算,也可以插值到站点和地面观测进行对比分析,图示如下:
|
|