- 积分
- 55948
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
MeteoInfo中的GridData类有很强的运算能力,这样就可以对格点数据进行计算分析。这个例子是用U/V格点数据计算风速、涡度、散度的程序。
#---- 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 *
#---- Define variables
BaseDir = "C:\\Program Files (x86)\\MeteoInfo\\"
MapDir = BaseDir + "Map\\"
DataDir = BaseDir + "Sample\\"
#---- Create MIApp object
myApp = MIApp()
#---- Open layers
myApp.OpenLayer(MapDir + "country1.shp")
myApp.SetLegendBreak("country1.shp",0,Color.Yellow,Color.Gray,1,True,False,True)
#---- Open data
myApp.OpenGrADSData(DataDir + "GrADS\\model.ctl")
myApp.SetDrawType("shaded")
#---- Get grid data
U = myApp.GetGridData("U")
V = myApp.GetGridData("V")
#---- Data calculation
#Speed = DataMath.Magnitude(U,V)
#Speed = DataMath.Sqrt(U * U + V * V)
#vort = DataMath.Hcurl(U,V)
digv = DataMath.Hdivg(U,V)
myApp.Display(digv)
#myApp.SetDrawType("vector")
#myApp.Display("U","V")
myApp.MoveLayerToTop("country1.shp")
myApp.ZoomLonLatEx(0,360,-90.1,90.1)
myApp.SetTitle("MeteoInfo script demo - Grid data calculation")
myApp.MapLayout.PaintGraphics()
#myApp.SaveFigure(".\\try.png")
Application.Run(myApp)
GrADS用同样的数据做出来的涡度、散度图:
|
|