- 积分
- 1655
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-4-12
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2014-4-14 11:59:03
|
显示全部楼层
你好,我按照wrf_user_intrp3d还有gsn_csm_pres_hgt_vector的函数介绍改了一下,但是提示
w_plane = wrf_user_intrp3d(w,z,"v",plane,0.,opts)
execute error。看了好久都没发现有什么错误
而且我总感觉我的这个脚本有些不对,您能不能帮我看看还有那些需要改的?万分感谢!
;----------------------------------------------------------------------
; vector_5.ncl
;
; Concepts illustrated:
; - Drawing pressure/height vectors over filled contours
; - Using "vinth2p" to interpolate to user specified pressure levels
; - Drawing curly vectors
; - Thinning vectors using a minimum distance resource
;----------------------------------------------------------------------
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
in = addfile("/home/Huanglei/data/d03"+".nc","r") ; open netcdf file
;************************************************
; read needed variables from file
;************************************************
times = wrf_user_getvar(in,"times",-1) ; get times in the file
ntimes = dimsizes(times) ; number of times in the file
FirstTime = True
mdims = getfilevardimsizes(in,"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(in,"tc",it) ; T in C
v = wrf_user_getvar(in,"V",it) ; v wind
w = wrf_user_getvar(in,"W",it) ; w wind
z = wrf_user_getvar(in, "z",it) ; grid point height
if ( FirstTime ) then ; get height info for labels
zmin = 0.
zmax = max(z)/1000.
nz = floattoint(zmax/2 + 1)
FirstTime = False
end if
plane = new(4,float)
plane = (/ 2,2, mdims(nd-1)-2, mdims(nd-2)-2 /)
opts = True
t_plane = wrf_user_intrp3d(tc,z,"v",plane,0.,opts)
v_plane = wrf_user_intrp3d(v,z,"v",plane,0.,opts)
w_plane = wrf_user_intrp3d(w,z,"v",plane,0.,opts)
dim = dimsizes(t_plane) ; Find the data span - for use in labels
zspan = dim(0)
; Options for XY Plots
opts_xy = res
opts_xy@tiYAxisString = "Height (km)"
opts_xy@cnMissingValPerimOn = True
opts_xy@cnMissingValFillColor = 0
opts_xy@cnMissingValFillPattern = 11
opts_xy@tmYLMode = "Explicit"
opts_xy@tmYLValues = fspan(0,zspan,nz) ; Create tick marks
opts_xy@tmYLLabels = sprintf("%.1f",fspan(zmin,zmax,nz)) ; Create labels
opts_xy@tiXAxisFontHeightF = 0.020
opts_xy@tiYAxisFontHeightF = 0.020
opts_xy@tmXBMajorLengthF = 0.02
opts_xy@tmYLMajorLengthF = 0.02
opts_xy@tmYLLabelFontHeightF = 0.015
opts_xy@PlotOrientation = tc_plane@Orientation
;************************************************
; Omega is significantly smaller than v, so we will
; scale it so that some vertical motion is visible
;************************************************
wAve = avg(w_plane(it,:,:,{104})) ; used for scaling
vAve = avg(v_plane(it,:,:,{104}))
scale = fabs(vAve/wAve)
wscale = w*scale ; now scale
copy_VarCoords(w, wscale) ; copy coordinate variables
;***********************************************
; create plot
;***********************************************
wks = gsn_open_wks ("pdf", "vector" ) ; open workstation
gsn_define_colormap(wks,"BlAqGrYeOrRevi200") ; choose color map
res = True ; plot mods desired
res@tiMainString = "Pressure/Height Vector" ; title
res@TimeLabel = times(it) ; Set Valid time to use on plots
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.01 ; thin out vectors
res@vcMapDirection = False
;*****************************************************
; draw plot from pole to pole at 170E
;*****************************************************
plot = gsn_csm_pres_hgt_vector(wks,t(it,:,:,{104}),v(it,:,:,{104}),\
wscale(it,:,:,{104}),res )
end do
end
|
|