爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 7000|回复: 5

[作图] 差值成850hpa的风场,出错,维数不对

[复制链接]

新浪微博达人勋

发表于 2014-1-16 17:24:01 | 显示全部楼层 |阅读模式

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

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

x
亲们,我想画850hpa风场,用wrf_user_intrp3d这个函数提示错误,下面是我的脚本,
;*************************************************
;
;************************************************
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"  ; Add special wrf functions
;************************************************
begin
;************************************************
; open file and read in data
;************************************************
; a = addfile("./wrfchemi_12z_d02.nc","r")
; a = addfile("./wrfinput_d01.nc","r")
a = addfile("./wrfout_d02_2014-01-06_12:00:00.nc","r")

;************************************************
; create plot
;************************************************
; type = "x11"
  type = "pdf"  
wks = gsn_open_wks(type ,"wrf-out-PM10")      ; open a ps file  
gsn_define_colormap(wks,"BlAqGrYeOrRe")    ; choose colormap
; gsn_define_colormap(wks,"CBR_wet")    ; choose colormap
  
pltres = True                              ; Set plot options
mpres = True                               ; Set map options


mpres@mpGridAndLimbOn        = True
mpres@mpGridLineDashPattern  = 2.
mpres@mpGridLatSpacingF      = 5.
mpres@mpGridLonSpacingF      = 5.
  
mpres@mpGeophysicalLineColor = "Black"
mpres@mpGeophysicalLineThicknessF = 2
mpres@mpNationalLineColor    = "Black"
mpres@mpNationalLineThicknessF    = 2
mpres@mpGridLineColor        = "Black"
mpres@mpGridLineThicknessF        = 2
mpres@mpLimbLineColor        = "Black"
mpres@mpLimbLineThicknessF        = 2
mpres@mpPerimLineColor       = "Black"
mpres@mpPerimLineThicknessF       = 2
mpres@mpUSStateLineColor          = "Black"
mpres@mpUSStateLineThicknessF     = 2
mpres@mpDataBaseVersion           = "MediumRes"
mpres@mpDataSetName               = "Earth..4"
mpres@mpOutlineSpecifiers         = (/"China:states"/)
mpres@tfDoNDCOverlay = True


  
  
res = True
res@MainTitle                   = "WRF-chem PM10"
res@Footer = False


;times  = wrf_user_list_times(a)  ; get times in the file
times = wrf_user_getvar(a,"Times",-1)  
ntimes = dimsizes(times(:,0))         ; number of times in the file
       

do  it=0,ntimes-1,1


    print("Working on time: " + times(it,:) )
   res@TimeLabel = times(it,:)   ; Set Valid time to use on plots
       
      ter= wrf_user_getvar(a,"PM2_5_DRY",it)
      u   = wrf_user_getvar(a,"U",it)        ; u averaged to mass points
      v   = wrf_user_getvar(a,"V",it)        ; v averaged to mass points
      pa   = wrf_user_getvar(a, "P",it) ; pressure
          pb   = wrf_user_getvar(a, "PB",it) ; pressure
          p=pa+pb
      u_plane(0,:,:)  = wrf_user_intrp3d(u,p,"h",850.,0.,False)
      v_plane(0,:,:)  = wrf_user_intrp3d(v,p,"h",850.,0.,False)
         
         
      spd     = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec
      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"
  

  
; Plotting options for PM10
opts = res
opts@cnFillOn              = True     ; turn on color fill
opts@ContourParameters = (/ 40., 300., 20. /) ; Set the levels
contour = wrf_contour(a,wks,ter(0,:,:),opts)
delete(opts)

; Plotting options for Wind Vectors                 
      opts = res         
     opts@FieldTitle = "850hpa Wind"
      opts@NumVectors = 50
           opts@vcGlyphStyle            = "FillArrow"         ; select wind barbs
           opts@vcMinDistanceF             =0.03 ;int
           opts@vcRefMagnitudeF      =20.
           opts@vcRefLengthF         = 0.02
       opts@vcMinFracLengthF     = 0.2
          
     vector = wrf_vector(a,wks,u_plane,v_plane,opts)
     delete(opts)


;plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)  
  plot = wrf_map_overlays(a,wks,(/contour,vector/),pltres,mpres)
;************************************************


  
end do
end


提示的错误fatal:Dimension size mismatch, dimension (2) of left hand side reference does not have the same size as the right hand side reference after subscripting.
fatal:Execute: Error occurred at or near line 277 in file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl


我的u,v风场选定了时间,应该都是三维的啊,差值到850hp应该是两维的,不知道为什么提示维数错误,求大神指点


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

新浪微博达人勋

发表于 2014-1-16 21:46:53 | 显示全部楼层
u_plane(0,:,:)  = wrf_user_intrp3d(u,p(0,:,:,:),"h",850.,0.,False)
v_plane(0,:,:)  = wrf_user_intrp3d(v,p(0,:,:,:),"h",850.,0.,False)
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-1-17 08:43:42 | 显示全部楼层
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-1-17 15:24:08 | 显示全部楼层
没人鸟我
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-1-23 12:47:13 | 显示全部楼层
维数不对一般不是三维两维的问题,是维数中向量长度的问题,你仔细梳理一下数据处理的流程图吧,慢慢找,这个别人一般是帮不上忙的。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-11-14 22:46:22 | 显示全部楼层
气压的最后一维是west_east
风速的最后一维是west_east_stag
它们的值不一样。
请问你后来解决了吗,我想知道是怎么解决的。
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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