- 积分
 - 1502
 
	- 贡献
 -  
 
	- 精华
 
	- 在线时间
 -  小时
 
	- 注册时间
 - 2012-4-12
 
	- 最后登录
 - 1970-1-1
 
 
 
 
 
 
 | 
	
 
NCL
| 系统平台: | 
  | 
 
| 问题截图: | 
- | 
 
| 问题概况: | 
想把WRF输出的数据限定自己想要的经纬度范围画出来,看了NCL的例子,http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_overlays.shtml设定了自己想要的区域,图是画出来了,但是等值线不对了。  | 
 
| 我看过提问的智慧: | 
看过  | 
 
| 自己思考时长(天): | 
3  | 
 
 
 
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册 
 
 
 
x
 
想把WRF输出的数据限定自己想要的经纬度范围画出来,看了NCL的例子,http://www.ncl.ucar.edu/Document ... _map_overlays.shtml设定了自己想要的区域,图是画出来了,但是等值线不对了。虽然底图区域缩小了,但是等值线并没有相应对应到地图上,求助~~我的脚本: 
;   Example script to produce dbz plots for a WRF real-data run, 
;   with the ARW coordinate dynamics option. 
;   November 2008 
 
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. 
 
        ; mdbz = wrf_user_getvar(a,(/"mdbz","1","1"/),it)  
     dbz = wrf_user_getvar(a,(/"dbz","1","1"/),it)  
  lat2d = wrf_user_getvar(a,"XLAT",it)   ; latitude 
  lon2d = wrf_user_getvar(a,"XLONG",it)  ; longitude 
     mpres  = True 
     opts = res     
          opts@sfXArray = lon2d 
  opts@sfYArray = lat2d 
     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@mpLimitMode = "LatLon"    ; Limit the map view. 
      mpres@mpLeftCornerLatF  =  29.32 
      mpres@mpRightCornerLatF =  32. 
      mpres@mpLeftCornerLonF  = 102.45 
      mpres@mpRightCornerLonF =105.57 
 
      ;opts@lbTitleOn="False" 
     ;contour = wrf_contour(a,wks,dbz(1,:,:),opts)     ; plot only lowest level 
    ; plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres) 
 
     contour = wrf_contour(a,wks,dbz(1,:,:),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 
 
画出的图: 
 
 
 |   
- 
设定区域后的图 
 
 
 
- 
之前没有设定区域的图 
 
 
 
 
 
 
 
 |