<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>