; pro pltce_vec,position,backgnd=backgnd,ylaboff=ylaboff,cgm=cgm,ps=ps @pltdat.h ; ; Plot vectors on CE projection: ; Include background (axes, labels, maps, etc) if keyword_set(backgnd) ; iback = 0 if keyword_set(backgnd) then iback = 1 ylaboffset = .18 if map.sltxax gt 0 then ylaboffset = .30 if keyword_set(ylaboff) then ylaboffset = ylaboff print,' ' nxvec = uframe.nx & nyvec = uframe.ny un = uframe.zz & vn = vframe.zz uvmag = fltarr(nxvec,nyvec,/nozero) uvmag(*,*) = !spval & ngood = 0 good = where(un ne !spval and vn ne !spval,ngood) if ngood gt 0 then uvmag(good) = sqrt(un(good)^2+vn(good)^2) fminmax, uvmag,nxvec*nyvec,minmag,maxmag,!spval print,'Global min,max of vector magnitudes =',minmag,maxmag ; ; Shift map and data in longitude (x-axis) if necessary: ; cenlon = map.projcen(1) xticlabs = ['-180','-120','-60','0','60','120','180'] if cenlon ne 0. then begin ix0 = ixfind(uframe.xx,nxvec,0.,5.) ixcen = ixfind(uframe.xx,nxvec,cenlon,5.) if ixcen lt ix0 then ishift = ix0-ixcen else ishift = -(ixcen-ix0) un = shift(un,ishift,0) vn = shift(vn,ishift,0) if iback gt 0 then begin xticlabs = ['-180','-120','-60','0','60','120','180'] if cenlon ne frame.xx(ixcen) then $ print,' Requested cenlon=',cenlon,' Actual cenlon used=',$ frame.xx(ixcen) tmplon = fltarr(frame.nx-1) for i=0,frame.nx-2 do tmplon(i) = frame.xx(i) tmplon = shift(tmplon,ishift) shiftlon = fltarr(frame.nx) for i=0,nxvec-2 do shiftlon(i) = tmplon(i) shiftlon(nxvec-1) = shiftlon(0) n = -1 for i=0,frame.nx-1 do begin if i mod 12 eq 0 then begin n = n+1 xticlabs(n) = strcompress(string(fix(shiftlon(i))),/remove_all) endif endfor endif endif else shiftlon = uframe.xx ; ; Increments for plotting vectors are hardwired: ; incx = 3 & incy = 2 un(0,*) = !spval & un(nxvec-1,*) = !spval un(*,0) = !spval & un(*,nyvec-1) = !spval un(where(findgen(nxvec) mod incx ne 1),*) = !spval un(*,where(findgen(nyvec) mod incy ne 0)) = !spval ; vectitle = 'U+V MAGNITUDE MIN,MAX = ' + $ strcompress(string(minmag,format="(G9.3)"),/remove_all)+', '+ $ strcompress(string(maxmag,format="(G9.3)"),/remove_all) print,' ',vectitle ; if vec.vmag eq 0. then begin vec.vmag = rnd(maxmag,50.) if vec.vmag le 0. then vec.vmag = float(maxmag) print,' using scale magnitude of ',vec.vmag endif ; ; Position is passed in from pltce: ; xll = position(0) & yll = position(1) xur = position(2) & yur = position(3) xmid = .5*(xll+xur) ; ; Draw background if necessary: ; if iback gt 0 then begin fac = 2.5/180.*(yur-yll) & fudge = 2.*fac mappos = [xll-fudge,yll-fudge,xur+fudge,yur+fudge] map_set,0.,cenlon,/noborder,/cyl,position=mappos xtitl = frame.xlab & ytitl = frame.ylab yticlabs = ['-90','-60','-30','0','30','60','90'] chsize_toplab = 1.5 & if keyword_set(cgm) then chsize_toplab = 1.2 chsize_tics = 1.3 & if keyword_set(cgm) then chsize_tics = 1. chsize_range = 1.1 & if keyword_set(cgm) then chsize_range = .8 if map.continents gt -1 then map_continents,mlinestyle=contline,$ color=map.continents if map.grid gt -1 then map_grid,/label,color=map.grid xyouts,xll+.5*(xur-xll),yur+.04,frame.toplab,/norm,$ charsize=chsize_toplab,align=.5 contour,frame.zz,frame.xx,frame.yy,/norm,/noerase,/nodata,$ position=position,$ xstyle=1,ystyle=1,ticklen=-.015,xtitle=xtitl,ytitle=ytitl,$ xticks=n_elements(xticlabs)-1,xminor=3,xtickname=xticlabs,$ yticks=n_elements(yticlabs)-1,yminor=3,ytickname=yticlabs,$ charsize=chsize_tics if map.sltxax gt 0 then begin sltxax,ut,shiftlon(0),shiftlon(frame.nx-1),position,.13 xyouts,xmid,yll-.26,frame.botlab,align=.5,/norm,charsize=chsize_range endif else $ xyouts,xmid,yll-.15,frame.botlab,align=.5,/norm,charsize=chsize_range endif ; ; Draw vectors: ; ips = 0 if n_elements(ps) gt 0 then ips = ps gridvec,un,vn,uframe.xx,uframe.yy,spval=!spval,$ position=position,map.proj,color=vec.vclr,ps=ips,$ scalemag=vec.vmag,scalelen=vec.vlen,xscale=xmid,yscale=yll-ylaboffset ; if iback gt 0 and ips le 0 then begin print,'Completed frame ',iframe iframe = iframe+1 endif return end