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

楼主 |
发表于 2014-4-24 15:01:47
|
显示全部楼层
; 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_dbz23")
gsn_define_colormap(wks,"WhViBlGrYeOrReWh")
; 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
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 intercept parameters
; for rain, snow, and graupel, which are consistent with
; Thompson, Rasmussen, and Manning (2004, Monthly Weather Review,
; Vol. 132, No. 2, pp. 519-542.)
; First "1" in wrf_user_getvar
; Frozen particles that are at a temperature above freezing will be
; assumed to scatter as a liquid particle.
; Second "1" in wrf_user_getvar
mdbz = wrf_user_getvar(a,(/"mdbz","1","1"/),it)
dbz = wrf_user_getvar(a,(/"dbz","1","1"/),it)
opts = res
opts@cnFillOn = True
opts@ContourParameters = (/ 5., 75., 5./)
; 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,mdbz,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)
lnres = True
lnres@gsLineThicknessF = 3.0
lnres@gsLineColor = "Red"
gsn_polyline(wks,plot,(/103.3, 105./),(/30.3, 32./),lnres)
tes = True
tes@returnInt = False ; return real values
loc1 = wrf_user_ll_to_ij(a, 103.3, 30.3, tes)
print("X/Y location is: " + loc1)
loc2 = wrf_user_ll_to_ij(a, 105., 32., tes)
print("X/Y location is: " + loc2)
draw(plot) ; This will draw the map and the shapefile outlines.
frame(wks)
delete(opts)
end do ; END OF TIME LOOP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end
|
|