爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5916|回复: 1

[作图] 新手求助!海拔高度20M时,ncl绘图错误

[复制链接]
发表于 2018-3-13 12:37:19 | 显示全部楼层 |阅读模式

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

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

x
height_levels = (/ 20.,200.,750., 1500./)  ,绘制同高度不同气压平面要素图,当海拔高度设置30以上时可以正常绘图,但是设为20时则提示错误,请问是哪里做错了呢?谢谢!
(0)    Working on time: 2017-01-14_00:00:00
fatal:The result of the conditional expression yields a missing value. NCL can not determine branch, see ismissing function
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 2580 in file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl

fatal:["Execute.c":8640]:Execute: Error occurred at or near line 3400 in file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl

fatal:["Execute.c":8640]:Execute: Error occurred at or near line 91 in file wrf_Height.ncl


[etprc@localhost 同高度不同气压平面要素图]$


附:wrf_Height.ncl
;   Example script to produce plots for a WRF real-data run,
;   with the ARW coordinate dynamics option.
;   Interpolating to specified height levels

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
;
; The WRF ARW input file.  
; This needs to have a ".nc" appended, so just do it.
  a = addfile("/home/etprc/下载/wrfout_d01_2017-01-14_00:00:00.nc","r")

; We generate plots, but what kind do we prefer?
  type = "x11"
; type = "pdf"
; type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"plt_HeightLevel")


; Set some basic resources
  res = True
  res@MainTitle = "REAL-TIME WRF"
  res@Footer = False

  pltres = True
  mpres = True
  mpres@mpGeophysicalLineColor = "Black"
  mpres@mpNationalLineColor    = "Black"
  mpres@mpUSStateLineColor     = "Black"
  mpres@mpGridLineColor        = "Black"
  mpres@mpLimbLineColor        = "Black"
  mpres@mpPerimLineColor       = "Black"


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


; What times and how many time steps are in the data set?
  times = wrf_user_getvar(a,"times",-1)  ; get all times in the file
  ntimes = dimsizes(times)         ; number of times in the file

; The specific height levels that we want the data interpolated to.
  height_levels = (/ 20.,200.,750., 1500./)   ; height levels to plot - in meter
  nlevels       = dimsizes(height_levels)     ; number of height levels

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  do it = 0,ntimes-1,2             ; TIME LOOP

    print("Working on time: " + times(it) )
    res@TimeLabel = times(it)   ; Set Valid time to use on plots

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need        

    tc = wrf_user_getvar(a,"tc",it)        ; T in C
    u  = wrf_user_getvar(a,"ua",it)        ; u averaged to mass points
    v  = wrf_user_getvar(a,"va",it)        ; v averaged to mass points
    p  = wrf_user_getvar(a, "pressure",it) ; pressure is our vertical coordinate
    z  = wrf_user_getvar(a, "z",it)        ; grid point height
    rh = wrf_user_getvar(a,"rh",it)        ; relative humidity

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    do level = 0,nlevels-1                 ; LOOP OVER LEVELS

      height = height_levels(level)

      p_plane  = wrf_user_intrp3d( p,z,"h",height,0.,False)
      tc_plane = wrf_user_intrp3d(tc,z,"h",height,0.,False)
      rh_plane = wrf_user_intrp3d(rh,z,"h",height,0.,False)
      u_plane  = wrf_user_intrp3d( u,z,"h",height,0.,False)
      v_plane  = wrf_user_intrp3d( v,z,"h",height,0.,False)

      u_plane = u_plane*1.94386     ; kts
      v_plane = v_plane*1.94386     ; kts
      u_plane@units = "kts"
      v_plane@units = "kts"


    ; Plotting options for T               
      opts = res                          
      opts@cnLineColor = "Red"
      opts@ContourParameters = (/ 5.0 /)
      opts@cnInfoLabelOrthogonalPosF = 0.07  ; offset second label information
      opts@gsnContourLineThicknessesScale = 2.0
      contour_tc = wrf_contour(a,wks,tc_plane,opts)
      delete(opts)


    ; Plotting options for Pressure
      opts = res                          
      opts@cnLineColor = "Blue"
      opts@gsnContourLineThicknessesScale = 3.0
      contour_p = wrf_contour(a,wks,p_plane,opts)
      delete(opts)


    ; Plotting options for RH               
      opts = res                          
      opts@cnFillOn = True  
      opts@ContourParameters = (/ 10., 90., 10./)
      opts@cnFillColors = (/"White","White","White", \
                            "White","Chartreuse","Green",\
                            "Green3","Green4", \
                            "ForestGreen","PaleGreen4"/)
      contour_rh = wrf_contour(a,wks,rh_plane,opts)
      delete(opts)


    ; Plotting options for Wind Vectors                 
      opts = res         
      opts@FieldTitle = "Wind"   ; overwrite Field Title
      opts@NumVectors = 47       ; wind barb density
      vector = wrf_vector(a,wks,u_plane,v_plane,opts)
      delete(opts)


    ; MAKE PLOTS                                       
      plot = wrf_map_overlays(a,wks,(/contour_rh,contour_tc,contour_p, \
                                vector/),pltres,mpres)


    end do      ; END OF LEVEL LOOP

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  end do        ; END OF TIME LOOP

end

1.png
密码修改失败请联系微信:mofangbao
发表于 2018-9-26 20:50:45 | 显示全部楼层
请问您解决了这个问题吗
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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