Hi,
I try to create a panel plot which contains both overlay and polyline
structures but the polyline stay in the background of the plot or cross
the panel plot labels. I try to fix the orders of the individual plots
using different resource definitions such as tfPolyDrawOrder but it is
not working. The plot must basically includes following,
- plot surface temperature
- overlay surface current vectors on it
- add line to it to show the regional ocean model domain
- put all of them into panel plot
Any suggestions are welcome.
Thanks,
--ufuk
--- The NCL script ---
; --------------------------------------------------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "roms_func.ncl"
; --------------------------------------------------------
begin
;--- parameters ---
tstep = 1
;--- open grid file ---
grid = addfile ("../in/med_grid.nc", "r")
;--- open output file ---
nc = addfile ("../ocean_his.nc", "r")
;--- read variable ---
vart = nc->temp(:,0,:,:)
varu = u2rho(nc->u(tstep,0,:,:))
varv = v2rho(nc->v(tstep,0,:,:))
;--- read coordinate variables (lat & lon) ---
lat2d = grid->lat_rho
lon2d = grid->lon_rho
vart@lat2d = lat2d
vart@lon2d = lon2d
varu@lat2d = lat2d(::3,::3)
varu@lon2d = lon2d(::3,::3)
varv@lat2d = lat2d(::3,::3)
varv@lon2d = lon2d(::3,::3)
time = nc->ocean_time(tstep)
date_arr = floattoint(ut_calendar(time, 0))
date_str = sprinti("%d", date_arr(0,0))+"-"+sprinti("%2.2d",
date_arr(0,1))+"-"+\
sprinti("%2.2d", date_arr(0,2))
;+" "+sprinti("%2.2d", date_arr(0,3))+":"+sprinti("%2.2d",
date_arr(0,4))
;--- create plot ---
wks = gsn_open_wks ("pdf", "plot_"+sprinti("%4.4d", tstep))
gsn_define_colormap(wks, "amwg_blueyellowred")
i = NhlNewColor(wks,0.8,0.8,0.8)
;--- set plot resource ---
res = True
res@gsnDraw = False
res@gsnFrame = False
res@gsnMaximize = True
res@cnFillOn = True
res@cnFillMode = "RasterFill"
res@cnLinesOn = False
res@cnLineLabelsOn = False
res@cnFillDrawOrder = "PreDraw"
res@gsnSpreadColors = True
res@gsnSpreadColorEnd = -3
res@cnInfoLabelOn = False
res@pmTickMarkDisplayMode = "Always"
res@tmYRLabelsOn = False
res@tmYROn = False
res@tmXTLabelsOn = False
res@tmXTOn = False
res@tiXAxisString = "Longitude"
res@tiYAxisString = "Latitude"
res@tiXAxisFontHeightF = 0.015
res@tiYAxisFontHeightF = 0.015
res@tmLabelAutoStride = True
res@lbLabelBarOn = False
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = floor(min(vart))
res@cnMaxLevelValF = ceil(max(vart))
res@cnLevelSpacingF = 2
;--- mapping properties ---
res@mpDataBaseVersion = "HighRes"
res@mpProjection = "LambertConformal"
res@mpOutlineDrawOrder = "PostDraw"
res@mpGridAndLimbOn = False
res@mpLambertParallel1F = grid->PLAT(0)
res@mpLambertParallel2F = grid->PLAT(1)
res@mpLimitMode = "Corners"
res@mpLeftCornerLatF = grid->P1
res@mpLeftCornerLonF = grid->P2
res@mpRightCornerLatF = grid->P3
res@mpRightCornerLonF = grid->P4
res@mpLambertMeridianF = 16.0
map = gsn_csm_contour_map(wks, vart(tstep,:,:), res)
;--- plot surface currents ---
res_vec = True
res_vec@gsnDraw = False
res_vec@gsnFrame = False
res_vec@pmTickMarkDisplayMode = "Always"
res_vec@tmYRLabelsOn = False
res_vec@tmYROn = False
res_vec@tmXTLabelsOn = False
res_vec@tmXTOn = False
res_vec@tiXAxisFontHeightF = 0.015
res_vec@tiYAxisFontHeightF = 0.015
res_vec@vcRefAnnoSide = "Bottom"
res_vec@vcRefAnnoJust = "BottomRight"
res_vec@vcGlyphStyle = "CurlyVector"
res_vec@vcRefAnnoOrthogonalPosF = -0.26
res_vec@vcRefAnnoParallelPosF = 0.2
res_vec@vcRefMagnitudeF = 0.05
res_vec@vcRefLengthF = 0.03
res_vec@vcMinDistanceF = 0.0
plot = gsn_csm_vector(wks, varu(::3,::3), varv(::3,::3), res_vec)
overlay(map, plot)
draw(map)
;--- plot domain box ---
dims = dimsizes(lat2d)
im = dims(1)
jm = dims(0)
delete(dims)
xbox = (/ lon2d(0,0),lon2d(0,im-1),lon2d(jm-1,im-1), \
lon2d(jm-1,0),lon2d(0,0) /)
ybox = (/ lat2d(0,0),lat2d(0,im-1),lat2d(jm-1,im-1), \
lat2d(jm-1,0),lat2d(0,0) /)
;--- create box array ---
x_out = new(dimsizes(xbox), "float")
y_out = new(dimsizes(ybox), "float")
res_line = True
res_line@gsLineThicknessF = 2.0
res_line@gsLineColor = "black"
res_line@tfPolyDrawOrder = "PostDraw"
datatondc(map, doubletofloat(xbox), doubletofloat(ybox), x_out, y_out)
gsn_polyline_ndc(wks, x_out, y_out, res_line)
;--- create panel plot ---
resP = True
resP@gsnFrame = False
resP@gsnPanelLabelBar = True
resP@lbOrientation = "vertical"
resP@pmLabelBarWidthF = 0.08
resP@pmLabelBarHeightF = 0.40
resP@pmLabelBarParallelPosF = 0.025
resP@pmLabelBarOrthogonalPosF = 0.005
resP@txFontHeightF = 0.012
resP@gsnPanelFigureStringsFontHeightF = 0.012
resP@gsnPanelFigureStrings= (/ date_str /)
gsn_panel(wks, map, (/ 1,1 /), resP)
frame(wks)
end
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Thu Mar 3 05:44:21 2011
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2011 - 10:00:25 MST