爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 10342|回复: 6

ncl如何画wrfout的垂直风场图

[复制链接]

新浪微博达人勋

发表于 2015-11-18 17:49:39 | 显示全部楼层 |阅读模式

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

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

x
使用gsn_csm_pres_hgt函数,结果出错,求大神帮帮忙
(0)        gsn_csm_pres_hgt: Fatal: The first dimension of the input data must
(0)        have a coordinate variable called 'lev.'
(0)        Cannot create plot.
fatal:Illegal right-hand side type for assignment
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 12473 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl


ncl脚本如下:
  1. ;================================================;
  2. ;  gsn_contour_2.ncl
  3. ;================================================;
  4. ; Concepts illustrated:
  5. ;   - Drawing a basic contour plot using gsn_contour
  6. ;   - Spanning the full color map for contour fill
  7. ;   - Turning on color fill for a contour plot
  8. ;   - Turning off contour line labels
  9. ;   - Turning off the contour informational label
  10. ;   - Changing the size/shape of a contour plot using viewport resources
  11. ;   - Increasing the size of tickmark labels
  12. ;
  13. ;================================================;
  14. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
  15. load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
  16. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
  17. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
  18. ; ================================================;
  19. begin
  20. ;=================================================;
  21. ; open file and read in data
  22. ;=================================================;
  23. cfilename="wrfout_ncl.cfg"
  24. cfils    =asciiread(cfilename,-1,"string")

  25. files = systemfunc("ls "+cfils(0)+":00:00") + ".nc"
  26. f = addfiles(files,"r")
  27. nfil=dimsizes(files)
  28. times  = wrf_user_list_times(f)
  29. U10=f[:]->U10(:,:,:)
  30. V10=f[:]->V10(:,:,:)
  31. U=wrf_user_getvar(f,"ua",-1)
  32. V=wrf_user_getvar(f,"va",-1)
  33. W=wrf_user_getvar(f,"wa",-1)
  34. Tc=wrf_user_getvar(f,"tc",-1)
  35. nxy=dimsizes(U)
  36. nt=nxy(0)
  37. nz=nxy(1)
  38. ny=nxy(2)
  39. nx=nxy(3)
  40. pa=wrf_user_getvar(f,"pressure",-1) ;full mode pressure(hpa)


  41. pressure_levels=(/1000.,900.,850.,750.,700.,600.,500.,300.,200./)
  42. nleves=dimsizes(pressure_levels)

  43. VV=new((/nt,nleves,ny,nx/),float)
  44. UU=new((/nt,nleves,ny,nx/),float)
  45. WW=new((/nt,nleves,ny,nx/),float)
  46. TTc=new((/nt,nleves,ny,nx/),float)


  47.   VV=wrf_user_intrp3d(V,pa,"h",pressure_levels,0.0,False)
  48.   UU=wrf_user_intrp3d(U,pa,"h",pressure_levels,0.0,False)
  49.   WW=wrf_user_intrp3d(W,pa,"h",pressure_levels,0.0,False)
  50.   TTc=wrf_user_intrp3d(Tc,pa,"h",pressure_levels,0.0,False)

  51. wAve=avg(WW(0,:,:,10))
  52. uAve=avg(UU(0,:,:,10))
  53. scale=fabs(uAve/wAve)
  54. wscale=WW*scale
  55. copy_VarCoords(WW,wscale)
  56. ;=================================================;
  57. ; PLOT 2
  58. ;=================================================;


  59.   



  60.   
  61.   res                     = True

  62. ;---This resource not needed in V6.1.0
  63.   res@gsnSpreadColors     = True         ; use full colormap
  64. res@vcRefAnnoOn         = True      ; turns off the ref vector
  65.   res@vcRefMagnitudeF  = 5.0                       ; add a reference vector
  66.   res@vcRefLengthF     = 0.045                     ; what the ref length is
  67.     res@vcGlyphStyle     = "CurlyVector"             ; turn on curley vectors

  68.   
  69. do ifle=0,0
  70.   wks  = gsn_open_wks("png",cfils(1)+"/gsi_UW_"+times(ifle))
  71.   gsn_define_colormap(wks,"gui_default")
  72.   
  73.   
  74.   plot=gsn_csm_pres_hgt_vector(wks,TTc(ifle,:,:,10),UU(ifle,:,:,10),wscale(0,:,:,10),res)
  75.   end do
  76.   

  77.   


  78.   end
复制代码


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

新浪微博达人勋

发表于 2016-10-3 18:52:38 | 显示全部楼层
楼主解决了吗
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-6-1 22:54:07 | 显示全部楼层
我看到的一个问题是,wrf_user_intrp3d使用错误,别的就不清楚了,你可以看下
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-10-17 11:00:35 | 显示全部楼层
请问楼主解决了吗,我跟你遇到了一样的问题,不知道该怎么解决
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-11-14 08:36:11 | 显示全部楼层
画wrfout数据的图不是用gsn_csm_pres_hgt_vector吧,你可以去找下专门wrf画图的命令
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2019-2-15 09:47:57 | 显示全部楼层
一样的问题,搞定了吗,楼主
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2019-6-6 17:17:03 | 显示全部楼层
最开始就不能按照层次插值 而且不能用gsn开头的函数画WRFOUT的剖面
你可以看看 http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/NCL_examples.php
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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