<div dir="ltr"><div>Hi<br><br></div>I think the issue is that wrf_map_overlays() calls frame()/draw() behind the scenes. At the bottom of the docs for this function, there's this guidance:<br><br><p>
If you want to use gsn_add_poly<i>xxxx</i> routines
(like <a href="http://ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_polymarker.shtml"><strong>gsn_add_polymarker</strong></a>) to add
primtives to a WRF plot, then you need to set:
</p><p>
</p><pre>plt_res@PanelPlot = True
plt_res@FramePlot = False
</pre>
<p>
before you call <strong>wrf_map_overlays</strong>.
Then, call the appropriate gsn_add_poly<i>xxxx</i> routine to
attach the desired primitives, and finally call
<a href="http://ncl.ucar.edu/Document/Functions/Built-in/draw.shtml"><strong>draw</strong></a>(plot) and <a href="http://ncl.ucar.edu/Document/Functions/Built-in/frame.shtml"><strong>frame</strong></a>(wks) to
draw the plot with the attached primitives and advance the frame. <br></p><p><br></p><p>Hope that helps...</p><p>Rick<br><br></p><p><br></p><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 2, 2015 at 7:43 AM, Kelsey Mulder <span dir="ltr"><<a href="mailto:kelsey.mulder@manchester.ac.uk" target="_blank">kelsey.mulder@manchester.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="word-wrap:break-word">Hello,
<div><br>
</div>
<div>I’m trying to overlay multiple trajectory paths on top of relative vorticity contours using gsn_add_polyline. I have tried seemingly everything but can only either manage to get all the trajectories on a separate page from my wrf contour map (what happens
with the script below) or to only get one trajectory to plot on my map. The NCL script is below and my file of trajectories is attached. Any help would be greatly appreciated!</div>
<div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<br>
<br>
Kelsey Mulder<br>
</div>
</div>
</div>
<div style="word-wrap:break-word">
<div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<br>
<br>
PhD Student, University of Manchester<br>
School of Earth, Atmospheric and Environmental Sciences<br>
Simon Building<br>
Oxford Road<br>
Manchester, M13 9PL<br>
United Kingdom<br>
<br>
Tel: <a href="tel:%2B44%20161%20306%203911" value="+441613063911" target="_blank">+44 161 306 3911</a><br>
<br>
<br>
</div>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">begin</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; The WRF ARW input file. </div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; This needs to have a ".nc" appended, so just do it.</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> a = addfile("./wrfout_d04_2011-11-29_12:00:<a href="http://00.nc" target="_blank">00.nc</a>","r")</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; We generate plots, but what kind do we prefer?</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; type = "x11"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> type = "pdf"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; type = "ps"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; type = "ncgm"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> wks = gsn_open_wks(type,"abs_vort_traj")</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> height = 500 ;height in meters</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> gsn_define_colormap(wks,"BlueWhiteOrangeRed")</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; Set some basic resources</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> res = True</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> res@MainTitle = "REAL-TIME WRF"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> res@gsnDraw = False ;Don't draw yet!</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> pltres = True</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> mpres = True</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> res@gsnFrame = False ;don't advance frame yet!</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpGeophysicalLineColor = "Black"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpGridLineColor = "Black"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpLimbLineColor = "Black"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpNationalLineColor = "Black"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpPerimLineColor = "Black"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpUSStateLineColor = "Black"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; What times and how many time steps are in the data set?</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> times = wrf_user_getvar(a,"times",-1) ; get times in the file</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> ntimes = dimsizes(times) ; number of times in the file</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;print(times)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;exit</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; do it = 0,ntimes-1,30 ; TIME LOOP</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> do it = 539,539,5 ;Nothing and broken s</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; do it = 569,569,5 ;Bulging</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; do it = 149,149,5 ;core/gap</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> print("Working on time: " + times(it) )</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> res@TimeLabel = times(it) ; Set Valid time to use on plots</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> ; Get the data</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> avo = wrf_user_getvar(a,"avo",it)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> z = wrf_user_getvar(a,"z",it)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> forig = wrf_user_getvar(a,"F",it)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> f = forig*100000</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> wstag = wrf_user_getvar(a,"W",it) ; w in m/s</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> w = wrf_user_unstagger(wstag,"Z")</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> ; Interpolate to pressure</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> av_plane = wrf_user_intrp3d(avo,z,"h",height,0,False)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> rvo = av_plane - f</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> w_plane = wrf_user_intrp3d(w,z,"h",height,0,False)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> copy_VarAtts(av_plane, rvo) ;copy variable attributes</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; rvo@description = "Relative Vorticity"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> ; Plotting options </div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> opts = res </div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> opts@cnFillOn = True </div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> opts@ContourParameters = (/ -5000., 5000., 1000./)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> contour_a = wrf_contour(a,wks,rvo,opts)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> delete(opts)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> opts = res</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> opts@cnFillOn = False</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> opts@ContourParameters = (/ 10., 20., 5./)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> opts@cnLineColor = "black"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; opts@gsnContourNegLineDashPattern = 1 ; sets negative contours to dash patter</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">n 1</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> contour_pos = wrf_contour(a,wks,w_plane,opts)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> delete(opts)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> opts = res</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> opts@cnFillOn = False</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; opts@gsnSpreadColorEnd = -3 ; End third from the last color in color map</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> opts@ContourParameters = (/ -20., -5., 5./)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> opts@cnLineColor = "grey50"</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; opts@gsnContourNegLineDashPattern = 1 ; sets negative contours to dash patter</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">n 1</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> contour_neg = wrf_contour(a,wks,w_plane,opts)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> delete(opts)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> ; MAKE PLOTS</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> plot = wrf_map_overlays(a,wks,(/contour_a,contour_pos,contour_neg/),pltres,mpres)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;======================================</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;Plot trajectory</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;=======================================</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> pltres@PanelPlot = True</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;also read in trajectory location file so we can plot location</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> hdata = readAsciiTable("./nothing_trajectories.txt",5,"float",0)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> maxtraj = 45</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> dum = new(maxtraj,graphic)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> do ntraj=1,maxtraj,1</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;ntraj = 1</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">heightdatastart = 61*(ntraj-1)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">heightdataend = heightdatastart+60</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> trajnumber = hdata(heightdatastart:heightdataend,0)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> timetraj = hdata(heightdatastart:heightdataend,1)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> xlocation = hdata(heightdatastart:heightdataend,2) ;in i units</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> ylocation = hdata(heightdatastart:heightdataend,3) ;in j units</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> zlocation = hdata(heightdatastart:heightdataend,4) ;in km</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> loc = wrf_user_ij_to_ll(a,xlocation,ylocation,True)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> xpt = loc(0,:)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> ypt = loc(1,:)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> gsres = True</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> first = True</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> gsres@gsMarkerIndex = 16 ; marker style (circle)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> gsres@gsMarkerSizeF = 8.0 ; marker size</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> gsres@gsMarkerColor = "black" ; maker color</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; create a unique marker to indicate the start of the trajectory</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> first@gsMarkerSizeF = 15.0 ; marker size</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> first@gsMarkerColor = "black" ; marker color</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> res_lines = True</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; res_lines@gsLineThicknessF = 3. ; 3x as thick</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> dum(ntraj-1) = gsn_add_polyline(wks,plot,xpt,ypt,res_lines)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">end do ;end trajectory loop</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> draw(plot)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> frame(wks)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> end do ; END OF TIME LOOP</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px;min-height:13px"><br>
</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">end</div>
</div>
</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>