- 积分
- 1014
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-1-3
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
请教各位学霸们,我在用NCL画wrfout输出的绝对涡度垂直剖面图时遇到几个问题:
1.纵坐标显示的坐标竟然不是气压坐标,请问如何能够修改呢?
2.总是出现下面的错误,可看官网上avo函数的用法就这样子呀,怎么修改呢?
下面是NCL脚本:
;----------------------------------------------------------------------
; WRF_cn_3.ncl
;
; Concepts illustrated:
; - Plotting WRF data
; - Plotting a cross section
; - Using "sprintf" to create nicely formatted text strings
;----------------------------------------------------------------------
; WRF: latitude-z cross section.
;----------------------------------------------------------------------
; These files are loaded by default in NCL V6.2.0 and newer
; 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
;---Open file; substitute your own WRF output file here
f = addfile("/home/lx/WRF_LX/WRFV3/test/em_real/wrfout_d01_2017-10-19_00:00:00.nc","r")
times = wrf_user_getvar(f,"times",-1) ; get all time values on file
;
; Read variables at given time and lon indexes
; Read W(bottom_top_stag,west_east) at Time=2, lon=70
; Read associated levels and latitudes
;
ntim = 10
nlon = 180
times = wrf_user_getvar(f,"times",-1) ; get all time values on file
; pvo = wrf_user_getvar(f,"pvo",-1)
; avo = wrf_user_getvar(f,"avo",-1)
U = f->U(ntim,:,:,nlon)
V = f->V(ntim,:,:,nlon)
MSFU = f->MAPFAC_U(ntim,:,nlon)
MSFV = f->MAPFAC_V(ntim,:,nlon)
MSFM = f->MAPFAC_M(ntim,:,nlon)
COR = f->F(ntim,:,nlon)
DX=f@DX
DY=f@DY
avo = wrf_avo( U,V,MSFU,MSFV,MSFM,COR,DX,DY,0)
w = f->W(ntim,:,:,nlon) ; W(bottom_top_stag,south_north)
lat = f->XLAT(ntim,:,nlon) ; lon(west_east)
znw = f->ZNW(ntim,:) ; znw(bottom_top_stag)
;---Add/change meta data to conform to netCDF convention standards
lat@units = "degrees_north" ; CF recommended units
w!0 = "lev" ; name dimensions
w&lev = znw ; assign values to named dimensions
w!1 = "lat"
w&lat = lat
avo!0 = "lev" ; name dimensions
avo&lev = znw ; assign values to named dimensions
avo!1 = "lat"
avo&lat = lat
;---Use simple array syntax [like f90] to change units
w = w*100. ; for demo change units
w@units = "cm/s"
;
; For labeling purposes only, determine the average
; latitude of the cross section
;
lon_avg = avg(f->XLONG(ntim,:,nlon)) ; avg is a built in function
;
; The "symMinMaxPlt" procedure determines contour limits that
; are symmetric.
;
wks = gsn_open_wks("pdf","WRF_cn")
gsn_define_colormap(wks,"BlAqGrYeOrReVi200"); select color map
res = True ; plot mods desired
res@gsnMaximize = True ; maximize plot size
res@cnFillOn = True ; turn on color
res@cnLinesOn = False ; turn off contour lines
res@trYReverse = True ; reverse y axis
res@tmXBTickSpacingF = 10. ; plot every 10th degree
symMinMaxPlt(w, 14, False, res) ; contributed.ncl
res@tiMainString = times(ntim)+" avg(lon)=" + \
sprintf("%5.2f", lon_avg)
plot = gsn_csm_contour(wks,avo,res)
end
下面是报错内容:
fatal:wrf_avo: u must have at least 3 dimensions
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 41 in file WRF_cn_3.ncl
拜托大家啦 |
|