爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 7071|回复: 1

[作图] 求助:用NCL画wrfout输出的绝对涡度垂直剖面图时遇到几个问题

[复制链接]
发表于 2018-9-1 16:44:16 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

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

拜托大家啦
密码修改失败请联系微信:mofangbao
发表于 2018-11-6 22:17:31 | 显示全部楼层
avo已经直接读出来,楼主为什么要再计算呢?
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表