<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&#39;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">&lt;<a href="mailto:kelsey.mulder@manchester.ac.uk" target="_blank">kelsey.mulder@manchester.ac.uk</a>&gt;</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 &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;</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 &quot;.nc&quot; appended, so just do it.</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">  a = addfile(&quot;./wrfout_d04_2011-11-29_12:00:<a href="http://00.nc" target="_blank">00.nc</a>&quot;,&quot;r&quot;)</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 = &quot;x11&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px"> type = &quot;pdf&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; type = &quot;ps&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">; type = &quot;ncgm&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">  wks = gsn_open_wks(type,&quot;abs_vort_traj&quot;)</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,&quot;BlueWhiteOrangeRed&quot;)</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 Â  Â  Â  Â  Â  Â  Â  Â  Â  = &quot;REAL-TIME WRF&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">  res@gsnDraw  Â  = False ;Don&#39;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&#39;t advance frame yet!</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpGeophysicalLineColor = &quot;Black&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpGridLineColor = &quot;Black&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpLimbLineColor = &quot;Black&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpNationalLineColor = &quot;Black&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpPerimLineColor = &quot;Black&quot;</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">mpres@mpUSStateLineColor = &quot;Black&quot;</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,&quot;times&quot;,-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(&quot;Working on time: &quot; + 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,&quot;avo&quot;,it)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">  Â  z Â  Â  = wrf_user_getvar(a,&quot;z&quot;,it)</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">  Â  forig = wrf_user_getvar(a,&quot;F&quot;,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,&quot;W&quot;,it)  Â  Â  ; w in m/s</div>
<div style="font-family:Menlo;font-size:11px;margin:0px">  Â  w Â  Â  = wrf_user_unstagger(wstag,&quot;Z&quot;)</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,&quot;h&quot;,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,&quot;h&quot;,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 = &quot;Relative Vorticity&quot;</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 = &quot;black&quot;</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 = &quot;grey50&quot;</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(&quot;./nothing_trajectories.txt&quot;,5,&quot;float&quot;,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  = &quot;black&quot;  Â  Â  ; 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  = &quot;black&quot; Â  Â  ; 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>