; ;------------------------------------------------------------------ ; pro pltlon,srf=srf,cgm=cgm,ps=ps @global.h @tgcmidl.h common lonprev, htscale_prev,ihtscale_prev,plotlon_prev print,'This is the local pltlon' ; ; Make longitude slice image: ; if keyword_set(cgm) le 0 and keyword_set(ps) le 0 then begin print,' ' if (slon.lon ne zmflag) then $ print,format="('Making lon slice frame ',i3,': field ',a,' lon=',f6.1)",$ iframe,frame.field,slon.lon $ else $ print,iframe,frame.field,$ format="('Making lon slice frame ',i3,': field ',a,' (ZONAL MEAN)')" endif frame.type = 'lon' ; ; Pressure on y-axis: ; if (slon.ihtscale le 0) then begin print,'pltlon: frame.ixfield=',frame.ixfield genlon = getlon(frame.ixfield,slon.lon,slon.log10) ixzpmin = ixfind(gcmzp,!kmx,slon.zprange(0),.5) if (ixzpmin lt 0) then begin print,'>>> pltlon: bad zpmin?? slon.zprange(0)=',slon.zprange(0) return endif ixzpmax = ixfind(gcmzp,!kmx,slon.zprange(1),.5) if (ixzpmax lt 0) then begin print,'>>> pltlon: bad zpmax?? slon.zprange(1)=',slon.zprange(1) return endif ny = ixzpmax-ixzpmin+1 ytitl = 'LN(P/P0)' plotlon = fltarr(!jmx,ny) ploty = fltarr(ny) for k=ixzpmin,ixzpmax do begin plotlon(*,k-ixzpmin) = genlon(*,k) ploty(k-ixzpmin) = gcmzp(k) endfor yrange=[slon.zprange(0),slon.zprange(1)] ; ; yhts used for altyax (see below): ; if slon.ihtyax gt 0 then begin yhts = fltarr(ny) if ims90 le 0 then begin genht = getlon(ixz,slon.lon,0) for k=ixzpmin,ixzpmax do $ yhts(k-ixzpmin) = calcmean(genht(*,k),!jmx,0,1.e-20,spval,0) endif else for k=ixzpmin,ixzpmax do yhts(k-ixzpmin) = ms90_zpht(k) chsize_htax = 0. & if keyword_set(cgm) then chsize_htax = 1. endif ; ; Height on y-axis: ; endif else begin nhtscale = fix((slon.htrange(1)-slon.htrange(0)) / slon.htrange(2) +$ 1.0000001) htscale = fltarr(nhtscale) for i=0,nhtscale-1 do htscale(i) = slon.htrange(0) + i*slon.htrange(2) ny = nhtscale plotlon = fltarr(!jmx,ny) if ihwm93 le 0 and ims90 le 0 and iiri le 0 then begin if chnge_lon le 0 and ihtscale_prev eq slon.ihtscale and $ arrayeq(htscale_prev,htscale) then begin print,' (Using ht interp of lon slice from previous definition)' plotlon = plotlon_prev endif else begin genlon = getlon(frame.ixfield,slon.lon,0) fht = getlon(ixz,slon.lon,0) cuthtint, genlon,fht,!jmx,!kmx,plotlon,htscale,nhtscale,$ ilog10(frame.ixfield),spval,ier,1 if (slon.log10 gt 0) then log10f, plotlon,!jmx*ny,rlogmin,spval endelse endif else $ ; hwm93, msis90, or iri: plotlon = getlon(frame.ixfield,slon.lon,slon.log10) ploty = fltarr(ny) ploty(*) = htscale(*) yrange=[ploty(0),ploty(ny-1)] ytitl = 'HEIGHT (KM)' if slon.ihtyax gt 0 then begin yhts = ploty chsize_htax = 0. & if keyword_set(cgm) then chsize_htax = 1. endif endelse fsli = plotlon xaxis = gcmlat yaxis = ploty fminmax, plotlon,!jmx*ny,rmin,rmax,spval print,' min,max=',rmin,rmax if rmin eq rmax then begin print,'>>> pltlon: apparent constant value -- no plot made' return endif ;openw,luw,'test/lon.ne.bin',/get_lun ;writeu,luw,plotlon ; ; Set up some labelling parameters: ; xticlabs = ['-90','-60','-30','0','30','60','90'] xtitl = 'LATITUDE (DEG)' ; ; Top label (field, longitude, ut, and local time): ; toptitle = strarr(2) fldlab = frame.field if fldlab eq 'UI' or fldlab eq 'VI' or fldlab eq 'WI' then begin if ionvel eq 1 then fldlab = fldlab + ' (ExB)' else $ fldlab = fldlab + ' (ExB+unvn)' endif fieldlab = 'LOG10(' + fldlab + ')' if (slon.log10 le 0) then fieldlab = fldlab fieldlab = model + ' ' + fieldlab toptitle(0) = fieldlab ut = tgcmhdr.ut if ihwm93 gt 0 then ut = hwm93.ut if ims90 gt 0 then ut = ms90.ut if iiri gt 0 then ut = iri.ut if (slon.lon ne zmflag) then begin slt = fslt(slt,ut,slon.lon,1) toptitle(1) = ' LON = ' + $ string(slon.lon,format="(f6.1)") + ' UT = ' + $ string(ut,format="(f4.1)") + ' SLT = ' + $ string(slt,format="(f5.2)") endif else $ toptitle(1) = ' ZONAL MEAN UT = ' + string(ut,format="(f4.1)") ; ; Use xll,yll,xur,yur to adjust image location -- all labels, clrbar, etc ; are keyed off these values ; xll,yll = normalized coords of lower left corner of image ; xur,yur = normalized coords of upper right corner of image ; xll_dev,yll_dev = like xll,yll, but in device coords ; xur_dev,yur_dev = like xur,yur, but in device coords ; xur = .92 & yur = .90 xll = .12 & yll = .29 if keyword_set(srf) then begin xur = .92 & yur = .90 xll = .12 & yll = .25 endif if slon.ihtyax gt 0 then xur = .85 ; ; Construct image, allowing for cmin,cmax, etc if cont.imapply is set: ; insight,plotlon if (imcon eq 0 or imcon eq 2) then begin if cont.imapply gt 0 then begin lonimage = bytscl(plotlon(*,*),top=!d.table_size-3,$ min=cont.cmin,max=cont.cmax)+1 indx = where(plotlon gt cont.cmax or plotlon lt cont.cmin, cnt) if cnt gt 0 then begin lonimage(indx) = 0 print,' Removed ',cnt,' points outside cmin,cmax' endif endif else begin lonimage = bytscl(plotlon(*,*),top=!d.table_size-3,min=rmin,max=rmax)+1 endelse indx = where(plotlon ge spval/10., cnt) if cnt ne 0 then begin lonimage(indx) = 0 ; make missing data black print,' Found ',cnt,' "missing data" points' endif if keyword_set(ps) eq 0 and keyword_set(cgm) eq 0 then begin XYll = convert_coord([xll],[yll],/norm,/to_device) xll_dev = XYll(0,0) & yll_dev = XYll(1,0) XYur = convert_coord([xur],[yur],/norm,/to_device) xur_dev = XYur(0,0) & yur_dev = XYur(1,0) lonimage=congrid(lonimage,xur_dev-xll_dev,yur_dev-yll_dev,/interp,$ /minus_one) endif else begin ; postscript or cgm: lonimage = rebin(lonimage(*,*),!jmx*imscale,ny*imscale) endelse endif barw = xur-xll & barh = .04 xbar = .5*(xll+xur)-.5*barw & ybar = yll-barh-.11 if keyword_set(srf) then ybar = yll-barh-.14 if cont.imapply le 0 then $ cblabels = [strcompress(string(rmin,format="(g10.4)"),/remove_all),$ strcompress(string(0.5*(rmin+rmax),format="(g10.4)"),/remove_all),$ strcompress(string(rmax,format="(g10.4)"),/remove_all)] $ else $ cblabels = [strcompress(string(cont.cmin,format="(g10.4)"),/remove_all),$ strcompress(string(0.5*(cont.cmin+cont.cmax),format="(g10.4)"),$ /remove_all),$ strcompress(string(cont.cmax,format="(g10.4)"),/remove_all)] chsize = 1.2 & if keyword_set(cgm) then chsize = 1. ; ; Set up contouring cmin,cmax,cint: ; rangetitle = 'MIN,MAX = ' + $ strcompress(string(rmin,format="(G10.4)"),/remove_all) + ', ' + $ strcompress(string(rmax,format="(G10.4)"),/remove_all) if imcon gt 0 then begin prntcon = cont.prntcon if keyword_set(cgm) or keyword_set(ps) then prntcon = 0 levels = conspec(plotlon,cont.cmin,cont.cmax,cont.cint,cont.nlev,$ prntcon) cont.nlev = n_elements(levels) if cont.nlev le 1 then begin print,'>>> too few contour levels: nlev=',cont.nlev,' -- no frame made' return endif ; ; clabels(cont.nlev) (c_labels) = int flag for whether or not to label ; contour line ; clines(cont.nlev) (c_linestyle) = int flag for linestyles ; (0=solid, 2=dashed) ; dashneg = 1 clabels = intarr(cont.nlev) clines = intarr(cont.nlev) ; default to solid lines (all 0's) for i=0,cont.nlev-1 do begin if cont.nthlab le 0 then clabels(i) = 0 else $ if cont.nthlab eq 1 then clabels(i) = 1 else $ if i mod cont.nthlab eq 0 then clabels(i)=1 else clabels(i)=0 if dashneg then begin clines(i) = 0 if levels(i) lt 0. then clines(i) = 2 endif endfor if cont.cint gt 0. then $ rangetitle = 'CONTOUR ' + $ strcompress(string(levels(0),format="(G9.3)"),/remove_all)+' TO '+$ strcompress(string(levels(cont.nlev-1),format="(G9.3)"),/remove_all)+' BY '+$ strcompress(string(levels(1)-levels(0),format="(G9.3)"),/remove_all) + $ ' (MIN,MAX=' + strcompress(string(rmin,format="(G9.3)"),/remove_all) + $ ',' + strcompress(string(rmax,format="(G9.3)"),/remove_all) + ')' $ else $ rangetitle = 'CONTOUR ' + $ strcompress(string(levels(0),format="(G9.3)"),/remove_all)+' TO '+$ strcompress(string(levels(cont.nlev-1),format="(G9.3)"),/remove_all)+' BY '+$ strcompress(string(levels(1)-levels(0),format="(G9.3)"),/remove_all) endif ; imcon > 0 (doing contours) ; ; History and model time label: ; histlab = mkhistlab() ; fac25 = 2.5/180.*(xur-xll) pltpos = [xll-fac25,yll,xur+fac25,yur] xmid = .5*(xur+xll) ; ; Display image: ; (xsize and ysize keywords to tv are used only if isps (postscript)) ; if (keyword_set(srf) eq 0) then begin xyouts,xmid,yur+.06,toptitle(0),/norm,charsize=chsize+.2*chsize,align=.5 xyouts,xmid,yur+.02,toptitle(1),/norm,charsize=chsize+.2*chsize,align=.5 case imcon of 0: begin ; image only tv,lonimage,xll,yll,/norm,xsize=xur-xll,ysize=yur-yll clrbar,barw,barh,xbar,ybar,cblabels,botcolor=1,topcolor=!d.table_size-2,$ charsize=1.2 contour,plotlon,gcmlat,ploty,/norm,/noerase,/follow,/nodata,$ position=[xll-fac25,yll,xur+fac25,yur],charsize=chsize,$ xtitle=xtitl,xticks=n_elements(xticlabs)-1,$ xminor=3,xtickname=xticlabs,ytitle=ytitl,xrange=[-90.,90.],$ xstyle=1,ystyle=1,yrange=yrange xyouts,xmid,yll-.23,histlab,align=.5,/norm,charsize=chsize xyouts,xmid,yll-.27,rangetitle,align=.5,/norm,charsize=chsize end 1: begin ; contour only contour,plotlon,gcmlat,ploty,/norm,/noerase,/follow,/nodata,$ position=[xll-fac25,yll,xur+fac25,yur],charsize=chsize,$ xtitle=xtitl,xticks=n_elements(xticlabs)-1,$ xminor=3,xtickname=xticlabs,ytitle=ytitl,xrange=[-90.,90.],$ xstyle=1,ystyle=1,yrange=yrange contour,plotlon,gcmlat,ploty,/norm,/noerase,/follow,levels=levels,$ position=[xll,yll,xur,yur],c_linestyle=clines,nlevels=cont.nlev,$ c_labels=clabels,c_charsize=chsize,xstyle=5,ystyle=5,$ xrange=[gcmlat(0),gcmlat(!jmx-1)],ytitle=ytitl,yrange=yrange,$ max_value=spval-100.,c_colors=[cont.conclr] xyouts,xmid,yll-.14,rangetitle,align=.5,/norm,charsize=chsize xyouts,xmid,yll-.18,histlab,align=.5,/norm,charsize=chsize end 2: begin ; image + contours tv,lonimage,xll,yll,/norm,xsize=xur-xll,ysize=yur-yll clrbar,barw,barh,xbar,ybar,cblabels,botcolor=1,topcolor=!d.table_size-2,$ charsize=1.2 contour,plotlon,gcmlat,ploty,/norm,/noerase,/follow,/nodata,$ position=[xll-fac25,yll,xur+fac25,yur],charsize=chsize,$ xtitle=xtitl,xticks=n_elements(xticlabs)-1,$ xminor=3,xtickname=xticlabs,ytitle=ytitl,xrange=[-90.,90.],$ xstyle=1,ystyle=1,yrange=yrange if (keyword_set(ps) eq 0 and keyword_set(cgm) eq 0) then begin contour,plotlon,gcmlat,ploty,/norm,/noerase,/follow,levels=levels,$ position=[xll,yll,xur,yur],charsize=chsize,c_linestyle=clines,$ nlevels=cont.nlev,c_labels=clabels,c_charsize=chsize,xstyle=5,$ ystyle=5,xrange=[gcmlat(0),gcmlat(!jmx-1)],ytitle=ytitl,$ yrange=yrange,max_value=spval-100.,c_colors=[cont.conclr] endif else begin condat = rebin(plotlon(*,*),!jmx*imscale,ny*imscale) contour,condat,/norm,/noerase,/follow,levels=levels,$ position=[xll,yll,xur,yur],charsize=chsize,c_linestyle=clines,$ nlevels=cont.nlev,c_labels=clabels,c_charsize=chsize,xstyle=5,$ ystyle=5,ytitle=ytitl,max_value=spval-100.,c_colors=[cont.conclr] contour,plotlon,gcmlat,ploty,/nodata,xstyle=5,ystyle=5,/norm,$ position=[xll,yll,xur,yur],/noerase ; for tcurs_sli endelse xyouts,xmid,yll-.22,rangetitle,align=.5,/norm,charsize=chsize xyouts,xmid,yll-.26,histlab,align=.5,/norm,charsize=chsize end else: endcase ; ; Add extra right hand axis in height: ; if slon.ihtyax gt 0 then begin if imcon eq 0 or imcon eq 2 then $ altyax, ny,yhts,ploty,6,xll,xur+fac25,yll,yur,chsize_htax else $ altyax, ny,yhts,ploty,6,xll,xur+.5*fac25,yll,yur,chsize_htax endif ; ; Make shaded surface: ; endif else begin charfac=2 indx = where(plotlon eq spval, cnt) shades=bytscl(plotlon,top=!d.table_size-3,min=rmin,max=rmax)+1 if cnt ne 0 then shades(indx) = 0 shade_surf,plotlon,gcmlat,ploty,xstyle=1,ystyle=1,shades=shades,$ xrange=[gcmlat(0),gcmlat(!jmx-1)],yrange=yrange,$ xtitle=xtitl,xticks=n_elements(xticlabs)-1,xminor=3,xtickname=xticlabs,$ ytitle=ytitl,position=[xll,yll,xur,yur],max_value=spval/100.,$ xcharsize=charfac,ycharsize=charfac,zcharsize=charfac,/norm,/noerase xyouts,.5*(xll+xur),yur+.05,toptitle(0),/norm,ali=0.5,charsize=chsize xyouts,.5*(xll+xur),yur,toptitle(1),/norm,ali=0.5,charsize=chsize clrbar,barw,barh,xbar,ybar,cblabels,botcolor=1,topcolor=!d.table_size-2,$ charsize=1.3 endelse if writeascii and keyword_set(cgm) le 0 and keyword_set(ps) le 0 then begin alltitle = toptitle(0)+toptitle(1) lustat = fstat(luascii) wrascii,luascii,plotlon,!jmx,ny,gcmlat,ploty,xtitl,ytitl,$ tgcmhdr.histvol,fieldlab,ifrdat,alltitle,"TGCMIDL" endif if keyword_set(cgm) le 0 and keyword_set(ps) le 0 and writeascii le 0 then begin print,'Completed frame ',iframe iframe = iframe+1 endif if slon.ihtscale gt 0 then htscale_prev = htscale ihtscale_prev = slon.ihtscale plotlon_prev = plotlon return end