[ncl-talk] The shp only appear on the last plot of a (/3,1/)panel
grace
313695096 at qq.com
Wed Jul 27 20:46:44 MDT 2016
Hi:
All,I have write a script to plot a (/3,1/)panel,but the shp I added only appeared on the last plot.
The description only worked on the first plot.
This is my script:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
;
; The WRF ARW input file.
; This needs to have a ".nc" appended, so just do it.
a = addfile("/public/home/huanglei/data/20160724/oldwrf/wrfout_d03_2016-07-23_12:00:00"+".nc","r")
; We generate plots, but what kind do we prefer?
; type = "x11"
type = "pdf"
; type = "ps"
; type = "ncgm"
wks = gsn_open_wks(type,"plt_Precip_oldwrf3km")
plot = new(3,graphic)
; Set some basic resources
res = True
mpres = True ; Map resources
mpres at mpOutlineOn = False ; Turn off map outlines
mpres at mpFillOn = False ; Turn off map fill
mpres at mpGridAndLimbOn = True
;res at mpProjection = "Lambert"
pltres = True ; Plot resources
pltres at PanelPlot = True ; Tells wrf_map_overlays not to remove overlays
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; What times and how many time steps are in the data set?
FirstTime = True
times = wrf_user_getvar(a,"times",-1) ; get all times in the file
ntimes = dimsizes(times) ; number of times in the file
; print(times)
; exit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
it_end = 29
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need
; Get non-convective, convective and total precipitation of 5km
rain_exp = wrf_user_getvar(a,"RAINNC",it_end)
rain_con = wrf_user_getvar(a,"RAINC",it_end)
rain_tot = rain_exp + rain_con
rain_tot at description = "Total Precipitation"
;calculate the precipitation
it_start = 22
rain_exp_save = wrf_user_getvar(a,"RAINNC",it_start)
rain_con_save = wrf_user_getvar(a,"RAINC",it_start)
rain_tot_save = rain_exp_save + rain_con_save
times_sav = times(it_start)
rain_tot_tend = rain_tot - rain_tot_save
rainc_tend = rain_con - rain_con_save ; CUMULUS PRECIPITATION
rainnc_tend= rain_exp - rain_exp_save ; SCALE PRECIPITATION
rain_tot_tend at description = "Precipitation of 3km(old wrf)"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Plotting options for Precipitation
opts_r = res
opts_r at UnitLabel = "mm"
opts_r at cnLevelSelectionMode = "ExplicitLevels"
opts_r at cnLevels = (/ .1, .2, .4, .8, 1.6, 3.2, 6.4, \
12.8, 25.6, 51.2/)
opts_r at cnFillColors = (/"White","DarkOliveGreen1", \
"DarkOliveGreen3","Chartreuse", \
"Chartreuse3","Green","ForestGreen", \
"Yellow","Orange","Red","Violet"/)
opts_r at cnInfoLabelOn = False
opts_r at cnConstFLabelOn = False
opts_r at cnFillOn = True
opts_r at vpHeightF = 0.1
opts_r at vpWidthF = 0.9
opts_r at lgLegendOn = False
opts_r at gsnDraw = False
opts_r at gsnFrame = False
opts_r at lbLabelBarOn = False
opts_r at Footer = False
opts_r at NoHeaderFooter =True
; Precipitation Tendencies
; opts_r at SubFieldTitle = "from " + times(it_start) + " to " + times(it_end)
contour_tend = wrf_contour(a,wks, rain_tot_tend,opts_r) ; total (color)
contour_rainc_tend = wrf_contour(a,wks, rainc_tend,opts_r) ; total cumulus precipitation (color)
contour_rainnc_tend = wrf_contour(a,wks, rainnc_tend,opts_r) ; total scale precipitation(color)
delete(opts_r)
; MAKE PLOTS
plot(0) = wrf_map_overlays(a,wks,contour_tend,pltres,mpres)
plot(1) = wrf_map_overlays(a,wks,contour_rainc_tend,pltres,mpres)
plot(2) = wrf_map_overlays(a,wks,contour_rainnc_tend,pltres,mpres)
;>============================================================<
; add China map
;>------------------------------------------------------------<
shp_name1 = "/public/home/huanglei/map/xian.shp"
lnres = True
lnres at gsLineColor = "gray25"
lnres at gsLineThicknessF = 0.5
id = gsn_add_shapefile_polylines(wks,plot(0),shp_name1,lnres)
id = gsn_add_shapefile_polylines(wks,plot(1),shp_name1,lnres)
id = gsn_add_shapefile_polylines(wks,plot(2),shp_name1,lnres)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;creat panel;;;;;;;;;;;;;;;
resP = True
resP at gsnFrame =False
resP at gsnPanelLabelBar = True
resP at gsnPanelBottom = 0.05
resP at gsnPanelTop = 0.95 ; Make sure not too close to
resP at gsnPanelBottom = 0.35 ; edge, so it maximizes better.
resP at tyPolyDrawList = True
gsn_panel(wks,plot,(/3,1/),resP)
; draw(plot) ; This will draw the map and the shapefile outlines.
frame(wks)
end
How can I slove the problem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160728/c9e4e480/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 103149 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160728/c9e4e480/attachment.jpe
More information about the ncl-talk
mailing list