- 积分
- 9
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-9-24
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本人NCL初学小白,在画剖面风矢图的时候出了一些问题。本来是用wrfout输出数据求平均之后作一个纬向剖面,看vw的矢量。用全数据的时候图没啥问题,然后我想只看33-37N,某个经度的这个范围,于是修改了数据范围,等于变向放大么?差不多,然后这个时候出的图的x轴刻度怎么修改都没用,只出了一个35N,尝试改成Manual和直接注释掉那几行都不行。还请各位大神帮忙
附代码
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/wrf/WRFUserARW.ncl"
begin
wks = gsn_open_wks("png","vw_theta")
f="./location02.txt"
nrow=numAsciiRow(f)
fili=asciiread(f,nrow,"string")
a=addfile(fili(0),"r")
xlat = wrf_user_getvar(a,"XLAT",0)
xlon = wrf_user_getvar(a,"XLONG",0)
ter = wrf_user_getvar(a,"HGT",0)
z = wrf_user_getvar(a,"z",0)
minlat = min(xlat) ; for use later
maxlat = max(xlat)
minlon = min(xlon)
maxlon = max(xlon)
u=new((/nrow,26,180,160/),"float")
u!2="south_north"
u!3="west_east"
u!1="buttom_top"
u!0="time"
v=new((/nrow,26,180,160/),"float")
v!2="south_north"
v!3="west_east"
v!1="buttom_top"
v!0="time"
w=new((/nrow,26,180,160/),"float")
w!2="south_north"
w!3="west_east"
w!1="buttom_top"
w!0="time"
avgu=new((/26,180,160/),"float")
avgu!1="south_north"
avgu!2="west_east"
avgu!0="buttom_top"
avgv=new((/26,180,160/),"float")
avgv!1="south_north"
avgv!2="west_east"
avgv!0="buttom_top"
avgw=new((/26,180,160/),"float")
avgw!1="south_north"
avgw!2="west_east"
avgw!0="buttom_top"
do i=0,nrow-1
a=addfile(fili(i),"r")
u0=wrf_user_getvar(a,"U",0)
u(i,:,:,:)=u0(0:25,0:179,0:159)
v0=wrf_user_getvar(a,"V",0)
v(i,:,:,:)=v0(0:25,0:179,0:159)
w0=wrf_user_getvar(a,"W",0)
w(i,:,:,:)=w0(0:25,0:179,0:159)
delete(u0)
delete(v0)
delete(w0)
end do
a=addfile(fili(0),"r")
avgu=dim_avg_n_Wrap(u,0)
avgv=dim_avg_n_Wrap(v,0)
avgw=dim_avg_n_Wrap(w,0)
zmin = 0.
zmax = 1.5 ; We are only interested in the first 6km
nz = 5
opts=False
plane=new(2,float)
;plane=(/92,92/)
plane=(/10,10/)
angle=0.
; xl=82
; xr=102
xl=82
xr=102
X_plane = wrf_user_intrp2d(xlat(xl:xr,xl:xr),plane,angle,opts)
X_desc = "latitude"
; X_plane = wrf_user_intrp2d(xlon,plane,angle,opts)
; X_desc = "longitude"
u_plane = wrf_user_intrp3d(avgu(:,xl:xr,xl:xr),z(:,xl:xr,xl:xr),"v",plane,angle,opts)
v_plane = wrf_user_intrp3d(avgv(:,xl:xr,xl:xr),z(:,xl:xr,xl:xr),"v",plane,angle,opts)
w_plane = wrf_user_intrp3d(avgw(:,xl:xr,xl:xr),z(:,xl:xr,xl:xr),"v",plane,angle,opts)
ter_plane = wrf_user_intrp2d(ter(xl:xr,xl:xr),plane,angle,opts)
cross_dims = dimsizes(u_plane)
rank = dimsizes(cross_dims)
iz_do = 12
do iz = 0,11
iz_do = iz_do-1
do ix = 0,cross_dims(rank-1)-1
if ( ismissing(u_plane(iz_do,ix)) ) then
u_plane(iz_do,ix) = u_plane(iz_do+1,ix)
end if
if ( ismissing(v_plane(iz_do,ix)) ) then
v_plane(iz_do,ix) = v_plane(iz_do+1,ix)
end if
if ( ismissing(w_plane(iz_do,ix)) ) then
w_plane(iz_do,ix) = w_plane(iz_do+1,ix)
end if
end do
end do
zz = wrf_user_intrp3d(z(:,xl:xr,xl:xr),z(:,xl:xr,xl:xr),"v",plane,angle,opts)
b = ind(zz(:,0) .gt. zmax*1000. )
zmax_pos = b(0) - 1
if ( abs(zz(zmax_pos,0)-zmax*1000.) .lt. abs(zz(zmax_pos+1,0)-zmax*1000.) ) then
zspan = b(0) - 1
else
zspan = b(0)
end if
delete(zz)
delete(b)
; X-axis lables
dimsX = dimsizes(X_plane)
xmin = X_plane(0)
xmax = X_plane(dimsX(0)-1)
xspan = dimsX(0)-1
nx = 6
res = True
res@cnInfoLabelOn =False
res@Footer = False
pltres = True
opts_ter = True
opts_ter@gsnYRefLine = 0.0
opts_ter@gsnAboveYRefLineColor = "black"
opts_ter@gsnDraw = False
opts_ter@gsnFrame = False
opts_ter@trYMaxF = zmax*1000
; Options for XY Plots
opts_xy = res
opts_xy@tmXLabelsOn = True
opts_xy@tiXAxisString = X_desc
opts_xy@tiYAxisString = "Height (km)"
opts_xy@cnMissingValPerimOn = True
opts_xy@cnMissingValFillColor = 0
opts_xy@cnMissingValFillPattern = 11
opts_xy@tmXTOn = False
opts_xy@tmYROn = False
opts_xy@tmXBMode = "Explicit"
opts_xy@tmXBValues = fspan(0,xspan,nx) ; Create tick marks
opts_xy@tmXBLabels = sprintf("%.1f",fspan(xmin,xmax,nx))
opts_xy@tmXBLabelFontHeightF = 0.015
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 = w_plane@Orientation
vcres = opts_xy
vcres@vcGlyphStyle = "LineArrow"
vcres@vcPositionMode = "ArrowTail"
vcres@vcRefAnnoOn = True
vcres@vcMinDistanceF = 0.03
vcres@vcRefMagnitudeF = 4.
vcres@vcLineArrowThicknessF = 3.0
vcres@vcMapDirection = False
vcres@vcFillArrowsOn = True
vcres@vcRefLengthF = 0.02
vcres@vcFillArrowHeadXF = 0.2
vcres@vcFillArrowHeadYF = 0.2
vcres@vcFillArrowHeadInteriorXF = 0.15
contour_ter = gsn_csm_xy(wks,X_plane,ter_plane,opts_ter)
vector = wrf_vector(a,wks,v_plane(0:zmax_pos,:),w_plane(0:zmax_pos,:),vcres)
plot = wrf_overlays(a,wks,(/contour_ter,vector/),pltres)
end
|
-
|