- 积分
- 1507
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-4-12
- 最后登录
- 1970-1-1
|
NCL
系统平台: |
|
问题截图: |
- |
问题概况: |
在官网上找到画垂直矢量的例子,自己加了个时间循环,提示维度不匹配,自己看了半天都没看出来什么原因,请大家帮忙看看 |
我看过提问的智慧: |
看过 |
自己思考时长(天): |
1 |
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
在官网上找到画垂直矢量的例子,自己加了个时间循环,提示维度不匹配,自己看了半天都没看出来什么原因,旁观者清,请大家帮忙看看。还有这个 w = f->W(it,:,0,:) ; import data + meta info
我把0改成70,是不是就把剖面改成south_north的第70个格点了呢?不是很懂
错误提示:
(0) Working on time: 2010-07-25_06:00:00
warning:VarVarWrite: Dimension names for dimension number (0) don't match, assigning name of rhs dimension to lhs and overwriting coordinate variable, use "(/../)" if this change is not desired
warning:VarVarWrite: rhs has no coordinate variable for dimension number (1), destroying coordinate var, use "(/../)" if this is not desired outcome
warning:["Execute.c":8567]:Execute: Error occurred at or near line 28 in file /home/Huanglei/WRF_2d_4.ncl
第28行就是 w = f->W(it,:,0,:) ; import data + meta info
脚本:
;********************************************************
; WRF: vector overlaid upon a contour of a scalar field
;********************************************************
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
;********************************************************
; open file
;********************************************************
f = addfile ("/home/Huanglei/data/d03"+".nc","r")
;********************************************************
; Read character variable Times
; Convert to type string for plotting purposes
;********************************************************
;times = chartostring(f->Times) ; built-in function
; What times and how many time steps are in the data set?
times = wrf_user_getvar(f,"times",-1) ; get all times in the file
ntimes = dimsizes(times) ; number of times in the file
do it = 2,ntimes-1 ; TIME LOOP
print("Working on time: " + times(it) )
; res@TimeLabel = times(it) ; Set Valid time to use on plots
;********************************************************
; Read W at Time=6, south_north=0, convert to cm/sec
;********************************************************
w = f->W(it,:,0,:) ; import data + meta info
w = w*100. ; demo: convert to cm/s
w@units = "cm/s" ; update units attribute
dimw = dimsizes(w) ; get dimensions
mx = dimw(1)
;********************************************************
; Associate vertical and horizontal coords to w
;********************************************************
znw = f->ZNW(it,:) ; znw(bottom_top_stag)
w!0 = "znw"
w&znw = znw ; assign values to named dimensions
dx = f@DX/1000. ; dx (km)
west_east = ispan(0,mx-1,1)*dx ; calculate x values
west_east@long_name = "west_east"
west_east@units = "km"
w&west_east = west_east ; associate "x" values with w
printVarSummary (w)
;********************************************************
; create a bogus wind array with all values 0.0
;********************************************************
u = w
u = 0.0
;********************************************************
; create plots
;********************************************************
wks = gsn_open_wks("pdf" ,"WRF_2d") ; ps,pdf,x11,ncgm,eps
gsn_define_colormap(wks,"BlWhRe") ; select color map
res = True ; plot mods desired
;;res@gsnMaximize = True ; uncomment to maximize size
res@trYReverse = True ; reverse to go bot[1.0 to top [0.0]
res@tiMainString = times(it) ; main title
res@vcRefMagnitudeF = 150. ; define vector ref mag
res@vcRefLengthF = 0.0080 ; define length of vec ref
res@vcLineArrowHeadMaxSizeF = 0.0075 ; default: 0.05 (LineArrow), 0.012 (CurlyVector)
plot = gsn_csm_vector(wks,u(::2,::4),w(::2,::4),res)
res@vcRefAnnoOrthogonalPosF = -0.18 ; move ref vector
res@vcMinDistanceF = 0.02 ; larger means sparser
plot = gsn_csm_vector(wks,u(::2,::4),w(::2,::4),res)
end do
end
|
|