<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<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; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; 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; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; 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: +44 161 306 3911<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:00.nc","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>
</body>
</html>