爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5552|回复: 4

[作图] 画假相当位温出现问题。

[复制链接]

新浪微博达人勋

发表于 2015-5-2 07:38:49 | 显示全部楼层 |阅读模式

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

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

x

绘制假相当位温出现错误,求改正。{:soso_e105:}
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin;
   a = addfile("/atm200/guest1/liuxr/WRFV3/run/wrfout_d02_2013-06-17_00:00:00.nc","r")  
;  type = "x11"
  type = "pdf"
;  type = "ps"
   wks = gsn_open_wks(type,"plt_PressureLevel3")
  gsn_define_colormap(wks,"wh-bl-gr-ye-re")
  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"
   mpres@mpGeophysicalLineThicknessF = 2.0
   mpres@mpGridLineThicknessF        = 2.0
   mpres@mpLimbLineThicknessF        = 2.0
   mpres@mpNationalLineThicknessF    = 2.0
   mpres@mpUSStateLineThicknessF     = 2.0
   mpres@mpDataBaseVersion="MediumRes"
  mpres@mpDataSetName="Earth..4"
  mpres@mpOutlineSpecifiers="China:Provinces"
   ; 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
pressure_levels = (/ 1000.,950.,900.,850.,800.,750.,700.,650.,600.,550.,500.,450.,400.,\
               350.,300.,250.,200.,150.,100./)   ; pressure levels to plot
   nlevels         = dimsizes(pressure_levels)     ; number of pressure levels
do it = 0,ntimes-1,2             ; TIME LOOP
     print("Working on time: " + times(it) )
     res@TimeLabel = times(it)   ;
    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) ;
     rh = wrf_user_getvar(a,"rh",it)        ; relative humidity;
z  = wrf_user_getvar(a, "z",it)
   
do level = 0,nlevels-1                 ; LOOP OVER LEVELS
      pressure = pressure_levels(level)
      
tc_plane = wrf_user_intrp3d(tc,p,"h",pressure_levels,0.,False)
   z_plane  = wrf_user_intrp3d( z,p,"h",pressure_levels,0.,False)
    rh_plane = wrf_user_intrp3d(rh,p,"h",pressure_levels,0.,False)
   u_plane  = wrf_user_intrp3d( u,p,"h",pressure_levels,0.,False)
   p_plane  = wrf_user_intrp3d( p,p,"h",pressure_levels,0.,False)
v_plane  = wrf_user_intrp3d( v,p,"h",pressure_levels,0.,False)
   spd     = (u_plane*u_plane + v_plane*v_plane)^(0.5) ;
     spd@description = "Wind Speed"
     spd@units = "m/s"
u_plane = u_plane*1.94386     ; kts
      v_plane = v_plane*1.94386     ; kts
      u_plane@units = "kts"
      v_plane@units = "kts"

tk=tc_plane+273.166
  P = conform(tc_plane,pressure_levels ,0)
  a1 = where(tk .gt. 263.0, 0.622*6.11*exp(17.26*(tk-273.16)/(tk-35.86)), \
                     0.622*6.11*exp(21.87*(tk-273.16)/(tk-7.66)))   ;
  b1= where(tk .gt. 263.0, P-0.278*exp(17.26*(tk-273.16)/(tk-35.86)),\
                 P-0.278*exp(21.87*(tk-273.16)/(tk-7.66)))   ;
  qs1=a1/b1
  q1=qs1*rh_plane
  e1=P*q1/100./(0.62197+q1/100.0)
  tk1=55.0+2840.0/(3.5*log(tk)-log(e1)-4.805)
  pot1=tk*(1000/P)^(0.2854*(1.0-0.28*q1/100.0))
  ept1=pot1*exp(((3376./tk1)-2.54)*q1/100.0*(1.0+0.81*q1/100.0)) ;
   ept1@description = "0se"
     ept1@units = "K"  
copy_VarCoords(tc_plane,ept1) ; assign coordinates

opts = res                          
      opts@cnLineColor = "Red"
      opts@ContourParameters = (/ 5.0 /)
      opts@cnInfoLabelOrthogonalPosF = 0.07  ; offset second label information
      opts@gsnContourLineThicknessesScale = 2.0
      contour_ept1 = wrf_contour(a,wks,ept1,opts)
      delete(opts)
     opts_z@ContourParameters = (/ 60.0 /)
          contour_height = wrf_contour(a,wks, z_plane,opts_z)
      
         plot = wrf_map_overlays(a,wks,(/contour_ept1/),pltres,mpres)
    delete(opts_z)


end do      
end do
end

fatal:Number of dimensions in parameter (2) of (wrf_contour) is (3), (2) dimensions were expected
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 94 in file xing

这里出现错误,求改正求改正。 contour_ept1 = wrf_contour(a,wks,ept1,opts)

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-5-2 10:00:22 | 显示全部楼层
根据提示,检查变量维数!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-10-20 15:31:13 | 显示全部楼层
请问楼主解决该问题了吗?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-10-22 21:18:46 | 显示全部楼层
请问P = conform(tc_plane,pressure_levels ,0)这句是什么意思?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-4-26 17:48:13 | 显示全部楼层
fatal:conform: the third argument contains a dimension that is out-of-range of the dimens               ions of x
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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