- 积分
- 1502
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-4-12
- 最后登录
- 1970-1-1
|
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
|
|