- 积分
- 55946
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 MeteoInfo 于 2011-10-19 12:18 编辑
这个例子展示了利用NCEP数据做水汽通量散度图的MeteoInfo脚本程序。需要更新MeteoInfo最新的文件(可以在置顶帖子中找到),这个没有经过验证,有兴趣的朋友可以用GrADS对同样的数据进行做图,对比一下。从图形来看2011年6月23日北京地区是水汽汇集中心,那天北京是大暴雨。
#---- Import class libraries
import clr
clr.AddReferenceByPartialName("System.Windows.Forms")
clr.AddReferenceByPartialName("System.Drawing")
from System.Windows.Forms import *
from System.Drawing import *
clr.AddReference("MeteoInfoC.dll")
from MeteoInfoC import *
from MeteoInfoC.Data import *
from MeteoInfoC.Data.MeteoData import *
#---- Define variables
BaseDir = "C:\\Program Files (x86)\\MeteoInfo\\"
MapDir = BaseDir + "Map\\"
DataDir = "E:\\Temp\\nc\\"
#---- Create MIApp object
myApp = MIApp()
#---- Open layers
myApp.OpenLayer(MapDir + "country1.shp")
myApp.SetLegendBreak("country1.shp",0,Color.Yellow,Color.Black,1,True,False,True)
#---- Open data
DataAir = MeteoDataInfo()
DataUwnd = MeteoDataInfo()
DataVwnd = MeteoDataInfo()
DataRhum = MeteoDataInfo()
DataAir.OpenNCData(DataDir + "air.2011.nc")
DataUwnd.OpenNCData(DataDir + "uwnd.2011.nc")
DataVwnd.OpenNCData(DataDir + "vwnd.2011.nc")
DataRhum.OpenNCData(DataDir + "rhum.2011.nc")
#---- Calculation
#---- Set date to June 23
tIdx = 171
DataAir.TimeIndex = tIdx;
DataUwnd.TimeIndex = tIdx;
DataVwnd.TimeIndex = tIdx;
DataRhum.TimeIndex = tIdx;
#---- Set level to 700hPa
lIdx = 3
DataAir.LevelIndex = lIdx;
DataUwnd.LevelIndex = lIdx;
DataVwnd.LevelIndex = lIdx;
DataRhum.LevelIndex = lIdx;
#---- Get grid data
air = DataAir.GetGridData("air")
uwnd = DataUwnd.GetGridData("uwnd")
vwnd = DataVwnd.GetGridData("vwnd")
rhum = DataRhum.GetGridData("rhum")
#---- Calculate
prs = 700
g = 9.8
es = 6.112*DataMath.Exp(17.67*(air-273.16)/(air-29.65))
qs = 0.62197*es/(prs-0.378*es)
q = qs*rhum/100
qhdivg = DataMath.Hdivg(q*uwnd/g,q*vwnd/g)
qv = rhum*es/100
uv = DataMath.Magnitude(uwnd, vwnd)
uvq = uv*qv/(9.8*1000)
#---- Plot data
myApp.SetDrawType("shaded")
myApp.Display(qhdivg)
myApp.MoveLayerToTop("country1.shp")
myApp.ZoomLonLatEx(0,360,-90.1,90.1)
aTime = DataAir.GetTime()
myApp.SetTitle("Water Vapor Flux Divergence - " + aTime.ToString("yyyy-MM-dd"))
myApp.MapLayout.PaintGraphics()
Application.Run(myApp)
|
|