ncl for rain
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load
"$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
;
;the WRF ARF input file
a =
addfile("./wrfout_d02_2012-07-22_00:00:00.nc","r")
rainc=a->RAINC
printVarSummary(rainc)
rainnc=a->RAINNC
printVarSummary(rainnc)
nt1=dimsizes(rainc(:,0,0))
nt2=dimsizes(rainnc(:,0,0))
;calculate the total precipitation
rain_exp=wrf_user_getvar(a,"RAINNC",-1)
rain_con=wrf_user_getvar(a,"RAINC",-1)
rain_tot=(rain_exp+rain_con)
rain_tot@description="Total Precipitation
(mm)"
; create a window
wks =
gsn_open_wks("png","wrf_total_rain")
;define colormap
cmap = (/ (/255, 255,
255/), \
(/
0, 0,
0/), \
(/255, 255,
255/), \
(/248, 248,
255/), \
(/191, 239,
255/), \
(/178, 223,
238/), \
(/187, 255,
255/), \
(/187, 255,
255/), \
(/174, 238,
238/), \
(/152, 245,
255/), \
(/122, 197,
205/), \
(/118,238,0/),\
(/238,230,133/),\
(/238, 154,
0/), \
(/205, 133,
0/), \
(/238,
92, 66/), \
(/255,
69, 0/),\
(/238,
64, 0/), \
(/ 205, 55,
0/) /) / 255.
gsn_define_colormap(wks,cmap)
; gsn_define_colormap(wks,"Rainbow")
;make some basic resources
res = True
res@gsnFrame = False
res@MainTitle = "Total Rain"
res@gsnDraw = False
res@cnLevelSelectionMode =
"ExplicitLevels"
res@cnFillOn = True
res@cnLinesOn = False
res@lbLabelAutoStride = True
res@cnFillDrawOrder = "PreDraw"
res@cnInfoLabelOn = False
; res@cnLevels = (/0,30,60,90,120,150,180,210/)
; res@cnFillColors =
(/"white","whitesmoke","turquoise1","turquoise2","turquoise3","greenyellow","green","green3","firebrick1","firebrick"/)
;res@cnConstFlabelOn = False
;res@mpFillOn = True
;res@cnFillAreaSpecifiers = (/"Land"/)
;res@mpAreamaskingOn = True
;res@mpMaskAreaSpecifiers = "Water"
contour_tot =
wrf_contour(a,wks,rain_tot(0,:,:),res)
;draw administrative region
mpres = True
mpres@gsnFrame = False
mpres@mpGridLineDashPattern
= 2
; lat/lon lines dashed
mpres@mpGeophysicalLineColor = "Black"
mpres@mpGeophysicalLineThicknessF = 2
mpres@mpNationalLineColor
= "Black"
mpres@mpNationalLineThicknessF
= 2
mpres@mpGridLineColor
=
"Black"
mpres@mpGridLineThicknessF
= 2
mpres@mpLimbLineColor
=
"Black"
mpres@mpLimbLineThicknessF
= 2
mpres@mpPerimLineColor
= "Black"
mpres@mpPerimLineThicknessF
= 2
mpres@mpUSStateLineColor
= "Black"
mpres@mpUSStateLineThicknessF
= 2
mpres@mpDataBaseVersion
= "MediumRes"
mpres@mpDataSetName
=
"Earth..4"
mpres@mpOutlineSpecifiers
=
(/"China:states"/)
pltres = True
pltres@gsnFrame = False
plot =
wrf_map_overlays(a,wks,(/contour_tot/),pltres,mpres)
;before make text, you should remember make pltres@gsnFrame
mpres@gsnFrame=False
tres = True
tres@gsnFrame = False
tres@txFontHeightF = 0.01
plat = (/39.9,40.0,39.10/)
plon = (/116.3,115.0,117.10/)
province = (/"BJ","HB","TJ"/)
do i=0,2
gsn_text(wks,plot,province(i),plon(i),plat(i),tres)
end do
frame(wks)
end
加载中,请稍候......