- 积分
- 1655
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-4-12
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2014-4-17 21:52:53
|
显示全部楼层
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
; file handling
;************************************************
; define filename
a = addfile("/home/Huanglei/data/d03"+".nc","r") ; open netcdf file
;************************************************
; read needed variables from file
;************************************************
times = wrf_user_getvar(a,"times",-1) ; get times in the file
ntimes = dimsizes(times) ; number of times in the file
mdims = getfilevardimsizes(a,"P") ; get some dimension sizes for the file
nd = dimsizes(mdims)
;---------------------------------------------------------------
do it = 3,ntimes-1,2 ; TIME LOOP
print("Working on time: " + times(it) )
tc = wrf_user_getvar(a,"tc",it) ; T in C
v = wrf_user_getvar(a,"V",it) ; v wind
w = wrf_user_getvar(a,"W",it) ; w wind
p = wrf_user_getvar(a, "pressure",it) ; grid point height
w := wrf_user_unstagger(w, w@stagger)
plane = new(4,float)
plane = (/ 2,2, mdims(nd-1)-2, mdims(nd-2)-2 /)
opts=True
t_plane = wrf_user_intrp3d(tc,p,"v",plane,0.,opts)
v_plane = wrf_user_intrp3d(v,p,"v",plane,0.,opts)
w_plane = wrf_user_intrp3d(w,p,"v",plane,0.,opts)
p_plane = wrf_user_intrp3d(p,p,"v",plane,0.,opts)
;************************************************
; Omega is significantly smaller than v, so we will
; scale it so that some vertical motion is visible
;************************************************
wAve = avg(w_plane(:,104)) ; used for scaling
vAve = avg(v_plane(:,104))
scale = fabs(vAve/wAve)
wscale = w_plane*scale ; now scale
t_plane!0="level"
t_plane&level=p_plane(:,0)
copy_VarCoords(t_plane, v_plane)
copy_VarCoords(t_plane, wscale) ; copy coordinate variables
printVarSummary(v_plane)
printVarSummary(t_plane)
printVarSummary(wscale)
;***********************************************
; create plot
;***********************************************
wks = gsn_open_wks ("pdf", "vector" ) ; open workstation
gsn_define_colormap(wks,"BlAqGrYeOrRevi200") ; choose color map
res = True ; plot mods desired
res@TimeLabel = times(it) ; Set Valid time to use on plots
res@tiMainString = "Pressure/Height Vector" ; title
res@tiYAxisString = "Pressure (mb)"
res@cnLineLabelsOn = False ; turn off line labels
res@cnFillOn = True ; turn on color fill
res@lbLabelStride = 2 ; every other color
res@gsnSpreadColors = True ; use full range of color map
res@vcRefMagnitudeF = 3.0 ; define vector ref mag
res@vcRefLengthF = 0.045 ; define length of vec ref
res@vcGlyphStyle = "CurlyVector" ; turn on curley vectors
res@vcMinDistanceF = 0.03 ; thin out vectors
res@vcMapDirection = False
;*****************************************************
; draw plot from pole to pole at 170E
;*****************************************************
plot = gsn_csm_pres_hgt_vector(wks,t_plane,v_plane,wscale,res )
end do
end
|
|