爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5075|回复: 2

画WRF输出数据,限定经纬度范围

[复制链接]
发表于 2014-12-3 09:56:58 | 显示全部楼层 |阅读模式
GrADS
系统平台:
问题截图: -
问题概况: 想把WRF输出的数据限定自己想要的经纬度范围画出来,本以为设定了mplatmin,mplatmax.mplonmin,maplatmax就可以了,谁知提示画图函数contour = wrf_contour(a,wks,dbz,opts)出错,将画图函数改为gsn_csm_contour_map,还是出错,求大神赐教
我看过提问的智慧: 看过
自己思考时长(天): 2

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

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

x
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/Huanglei/data/d032"+".nc","r")

; We generate plots, but what kind do we prefer?
  type = "pdf"
; type = "pdf"
; type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"plt_dbzmax1")
  gsn_define_colormap(wks,"WhViBlGrYeOrReWh")       ; Overwrite the standard color map

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

   pltres = True
pltres@PanelPlot  = True   ; Tells wrf_map_overlays not to remove overlays
  mpres = True
mpres@mpOutlineOn = False  ; Turn off map outlines
mpres@mpFillOn    = False  ; Turn off map fill

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

; Which 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

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

  do it = 1,ntimes-1               ; TIME LOOP
;it=20
     print("Working on time: " + times(it) )
     res@TimeLabel = times(it)   ; Set Valid time to use on plots


; First get the variables we will need        
; Both dbz and mdbz will be calculated using constant intercept parameters
; (as in early Reisner-2), with values of 8x10^6, 2x10^7, and 4x10^6 m^-4,
; for rain, snow, and graupel, respectively.


     dbz = wrf_user_getvar(a,(/"dbz","1","1"/),it)

     opts = res                        
     opts@cnFillOn = True  
     opts@ContourParameters = (/ 5., 65., 5./)
         opts@lbAutoManage= True
      opts@lbOrientation="Vertical"
  opts@pmLabelBarParallelPosF = 1.08 ;default = 0.5
  opts@pmLabelBarOrthogonalPosF =-0.9  ;lb的位置 default = 0.02
      opts@pmLabelBarWidthF      = 0.2               ; default is shorter
      opts@pmLabelBarHeightF     = 0.6               ; default is taller
      opts@lbTitleOn        = False                  ; turn on titl
          opts@lbLabelFontHeightF    = 0.000001             ; default is HUGE
          opts@lbTitlePosition  =  "Right"
          opts@lbTitleDirection = "Down"
      opts@mpMinLatF            = 29.32      ; range to zoom in on
      opts@mpMaxLatF            =  32.
      opts@mpMinLonF            =  102.45
      opts@mpMaxLonF            = 105.57

     contour = wrf_contour(a,wks,dbz,opts)
     plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)

;>============================================================<
;                      add China map
;>------------------------------------------------------------<


  shp_name1    = "/home/Huanglei/map/China/diquJie_polyline.shp"

  lnres                  = True
  lnres@gsLineColor      = "gray25"
  lnres@gsLineThicknessF = 0.5   

id = gsn_add_shapefile_polylines(wks,plot,shp_name1,lnres)
  shp_name2    = "/home/Huanglei/map/China/cnmap/cnhimap.shp"

  prres=True
  prres@gsLineThicknessF = 2.0      
  prres@gsLineColor = "black"
  plotcn3 = gsn_add_shapefile_polylines(wks,plot,shp_name2,prres)
  draw(plot)
  frame(wks)
delete(opts)
   end do        ; END OF TIME LOOP

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end


密码修改失败请联系微信:mofangbao
发表于 2014-12-3 10:44:42 | 显示全部楼层
这个是NCL。。。不是GRADS吧。。。。
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-12-3 11:02:22 | 显示全部楼层
啊夏 发表于 2014-12-3 10:44
这个是NCL。。。不是GRADS吧。。。。

是啊
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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