[ncl-talk] change the subtitles for each plot within a panel
LSL
lslrsgis at whu.edu.cn
Mon Mar 18 00:06:05 MDT 2019
Dear NCL Community,
I have wondering how to change the subtitles for each plot within a 2*2
panel.
.ncl script and .png results are attached. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190318/5f9be294/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Comparison_WRF_REF_ALB_LAI_GVF_2015-01-01_12:00:00.png
Type: image/png
Size: 114527 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190318/5f9be294/attachment.png>
-------------- next part --------------
;==========================================================================================
;--Read text file names
DIR_WRF="/vd03/sliu/WRF_SIMU/WRF/WRF/test/em_real_1y_2015_replace_ALB_LAI_GVF/wrf.simu.REF/d01/"
FIL_WRF="wrfout_d01_2015-"
flnm = systemfunc("cd "+DIR_WRF+" ; ls "+FIL_WRF+"*")
nflnm = dimsizes(flnm)
print(flnm)
print("===")
;--Loop over each precipitation file
; do nf=0,nflnm-1
do nf=0,1-1
print("Now is processing WRF FILE "+flnm(nf)+"....................")
ymd = str_get_cols(flnm(nf), 11, 20) ; yyyy-mm-dd
yyyy = str_get_cols(flnm(nf), 11, 14)
mm = str_get_cols(flnm(nf), 16, 17)
dd = str_get_cols(flnm(nf), 19, 20)
tt = str_get_cols(flnm(nf), 22, 29)
;===========================================================================
; Read wrf REF file
DIR_WRF_REF="/vd03/sliu/WRF_SIMU/WRF/WRF/test/em_real_1y_2015_replace_ALB_LAI_GVF/wrf.simu.REF/d01/"
DIR_WRF_GVF="/vd03/sliu/WRF_SIMU/WRF/WRF/test/em_real_1y_2015_replace_ALB_LAI_GVF/wrf.simu.GVF/d01/"
DIR_WRF_ALB="/vd03/sliu/WRF_SIMU/WRF/WRF/test/em_real_1y_2015_replace_ALB_LAI_GVF/wrf.simu.ALB/d01/"
DIR_WRF_LAI="/vd03/sliu/WRF_SIMU/WRF/WRF/test/em_real_1y_2015_replace_ALB_LAI_GVF/wrf.simu.LAI/d01/"
file_wrf_ref="wrfout_d01_"+yyyy+"-"+mm+"-"+dd+"_"+tt
fwrf_ref = addfile(DIR_WRF_REF+flnm(nf),"r")
tc2_ref = wrf_user_getvar(fwrf_ref,"T2",-1) ; T2 in Kelvin
tc2_ref = tc2_ref-273.16 ; T2 in C
tc0_ref = wrf_user_getvar(fwrf_ref,"TSK",-1) ; T0 in Kelvin
tc0_ref = tc0_ref-273.16
; Get non-convective, convective and total precipitation
rain_exp = wrf_user_getvar(fwrf_ref,"RAINNC",-1)
rain_con = wrf_user_getvar(fwrf_ref,"RAINC",-1)
rain_tot = rain_exp + rain_con
rain_tot at description = "Total Precipitation"
rain_tot_ref=rain_tot(0,:,:)*1000
file_wrf_gvf="wrfout_d01_"+yyyy+"-"+mm+"-"+dd+"_"+tt
fwrf_gvf = addfile(DIR_WRF_GVF+flnm(nf),"r")
tc2_gvf = wrf_user_getvar(fwrf_gvf,"T2",-1) ; T2 in Kelvin
tc2_gvf = tc2_gvf-273.16 ; T2 in C
tc0_gvf = wrf_user_getvar(fwrf_gvf,"TSK",-1) ; T0 in Kelvin
tc0_gvf = tc0_gvf-273.16
; Get non-convective, convective and total precipitation
rain_exp = wrf_user_getvar(fwrf_gvf,"RAINNC",-1)
rain_con = wrf_user_getvar(fwrf_gvf,"RAINC",-1)
rain_tot = rain_exp + rain_con
rain_tot at description = "Total Precipitation"
rain_tot_gvf=rain_tot(0,:,:)*1000
file_wrf_alb="wrfout_d01_"+yyyy+"-"+mm+"-"+dd+"_"+tt
fwrf_alb = addfile(DIR_WRF_ALB+flnm(nf),"r")
tc2_alb = wrf_user_getvar(fwrf_alb,"T2",-1) ; T2 in Kelvin
tc2_alb = tc2_alb-273.16 ; T2 in C
tc0_alb = wrf_user_getvar(fwrf_alb,"TSK",-1) ; T0 in Kelvin
tc0_alb = tc0_alb-273.16
; Get non-convective, convective and total precipitation
rain_exp = wrf_user_getvar(fwrf_alb,"RAINNC",-1)
rain_con = wrf_user_getvar(fwrf_alb,"RAINC",-1)
rain_tot = rain_exp + rain_con
rain_tot at description = "Total Precipitation"
rain_tot_alb=rain_tot(0,:,:)*1000
file_wrf_lai="wrfout_d01_"+yyyy+"-"+mm+"-"+dd+"_"+tt
fwrf_lai = addfile(DIR_WRF_LAI+flnm(nf),"r")
tc2_lai = wrf_user_getvar(fwrf_lai,"T2",-1) ; T2 in Kelvin
tc2_lai = tc2_lai-273.16 ; T2 in C
tc0_lai = wrf_user_getvar(fwrf_lai,"TSK",-1) ; T0 in Kelvin
tc0_lai = tc0_lai-273.16
; Get non-convective, convective and total precipitation
rain_exp = wrf_user_getvar(fwrf_lai,"RAINNC",-1)
rain_con = wrf_user_getvar(fwrf_lai,"RAINC",-1)
rain_tot = rain_exp + rain_con
rain_tot at description = "Total Precipitation"
rain_tot_lai=rain_tot(0,:,:)*1000
printVarSummary(rain_tot_ref)
; print(tc0_ref(0,:,:))
;============================================================================
;--Plotting options
pltDir = "./PLOT/"
pltName = "Comparison_WRF_REF_ALB_LAI_GVF"
pltPath = pltDir + pltName
pltType = "png" ; "x11"
wks = gsn_open_wks(pltType,pltPath+"_"+ymd+"_"+tt)
gsn_define_colormap(wks,"rainbow") ; overwrite the .hluresfile color map
; Set some basic resources
res = True
res at NoHeaderFooter = True ; Switch headers and footers off
pltres = True
pltres at PanelPlot = True ; Indicate these plots are to be paneled.
mpres = True
plots = new ( 4, graphic )
t_res = res
t_res at cnFillOn = True
t_res at ContourParameters = (/ 240.-273., 300.-273., 5. /)
t_res at lbLabelBarOn = False ; Turn off individual label bars so we can
t_res at tiMainString = "WRF REF"
contour = wrf_contour(fwrf_ref,wks,tc0_ref(0,:,:),t_res)
plots(0) = contour
delete(contour)
contour = wrf_contour(fwrf_alb,wks,tc0_alb(0,:,:),t_res)
plots(1) = contour
delete(contour)
contour = wrf_contour(fwrf_gvf,wks,tc0_gvf(0,:,:),t_res)
plots(2) = contour
delete(contour)
contour = wrf_contour(fwrf_lai,wks,tc0_lai(0,:,:),t_res)
plots(3) = contour
delete(contour)
; Panel the WRF plots.
pnlres = True
pnlres at txString = tc0_ref at description + " "+" "+ymd+" "+tt
pnlres at gsnPanelYWhiteSpacePercent = 13 ; Add white space b/w plots.
pnlres at gsnPanelLabelBar = True ; Turn on common labelbar
pnlres at lbLabelAutoStride = True ; Spacing of lbar labels.
pnlres at lbBoxMinorExtentF = 0.13
gsn_panel(wks,(/plots/),(/2,2/),pnlres)
end do
More information about the ncl-talk
mailing list