码迷,mamicode.com
首页 > 其他好文 > 详细

MeteoInfoLab脚本示例:计算水平螺旋度

时间:2015-10-10 09:10:01      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:

尝试了用MeteoInfoLab编写计算水平螺旋度的脚本,结果未经验证。

脚本程序:

print Open data files...
f_uwnd = addfile(D:/Temp/nc/uwnd.2011.nc)
f_vwnd = addfile(D:/Temp/nc/vwnd.2011.nc)

print Calculate average wind field from 850 to 600 hpa...
tidx = 173    # Jun 23, 2011
t = f_uwnd.gettime(tidx)
level = [850,600]    # 850 - 600 hPa
lat = [15,55]
lon = [70,135]
uvar = f_uwnd[uwnd]
vvar = f_vwnd[vwnd]
uwnd = uvar[tidx,level,lat,lon]
vwnd = vvar[tidx,level,lat,lon]
uc = uwnd.ave()
vc = vwnd.ave()
sp = magnitude(uwnd, vwnd)
speed = sp.ave()
#speed = magnitude(uc, vc)
direc = atan2(vc, uc)
cdirec = direc-40./180.*3.14159
if cdirec < -3.14159:
    cdirec=cdirec+3.14159*2
cuc = speed*cos(cdirec)
cvc = speed*sin(cdirec)

print Calculate horizontal helicity...
Hrs = 0.
zHrs = 0.
hh = 6
while hh <= 10:
    zHrs = (uvar[tidx,hh+1,lat,lon]-cuc)*(vvar[tidx,hh,lat,lon]-cvc)-         (uvar[tidx,hh,lat,lon]-cuc)*(vvar[tidx,hh+1,lat,lon]-cvc)
    Hrs = Hrs+zHrs
    hh += 1
Hrs = Hrs[::-1,:]

print Plot...
axesm()
mlayer = shaperead(D:/Temp/map/country1.shp)
geoshow(mlayer, edgecolor=black)
layer = contourfm(Hrs, 20)
title(Horizontal helicity ( + t.strftime(%Y-%m-%d) + ))
colorbar(layer)

技术分享

MeteoInfoLab脚本示例:计算水平螺旋度

标签:

原文地址:http://www.cnblogs.com/yaqiang/p/4865725.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!