; ;------------------------------------------------------------------ ; pro pltce,cgm=cgm,ps=ps @tgcmidl.h @global.h ; ; Make cylindrical equidistant plot: ; frame.type = 'map' fieldlab = 'LOG10(' + frame.field + ')' if (map.log10 le 0) then fieldlab = frame.field fieldlab = model + ' ' + fieldlab if map.vec gt 0 then begin ; plotting vectors if map.vec eq 1 then begin ; plotting vectors only if map.iuv eq 1 then fieldlab = 'UN+VN (M/S)' if map.iuv eq 2 then begin ; ui+vi if ionvel eq 1 then fieldlab = 'UI+VI (M/S) (ExB)' if ionvel eq 2 then fieldlab = 'UI+VI (M/S) (ExB+unvn)' endif endif if map.vec eq 2 then begin ; plotting vectors+image/contours if map.iuv eq 1 then fieldlab = fieldlab + ' (UN+VN)' if map.iuv eq 2 then begin ; ui+vi if ionvel eq 1 then fieldlab = fieldlab + ' (UI+VI ExB)' if ionvel eq 2 then fieldlab = fieldlab + ' (UI+VI ExB+unvn)' endif endif endif 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 iiri gt 0 and frame.ixfield ge iri.ix1_htindep then begin toplab = fieldlab + ' UT = ' + $ strcompress(string(ut,format="(f4.1)"),/remove_all) endif else begin if map.iht le 0 then begin toplab = fieldlab + ' ZP = ' + $ strcompress(string(map.zp,format="(f5.1)"),/remove_all) + ' UT = ' + $ strcompress(string(ut,format="(f4.1)"),/remove_all) endif else begin toplab = fieldlab + ' HT = ' + $ strcompress(string(map.ht,format="(f5.1)"),/remove_all) + ' UT = ' + $ strcompress(string(ut,format="(f4.1)"),/remove_all) endelse endelse if keyword_set(cgm) le 0 and keyword_set(ps) le 0 then begin print,' ' print,format="('Making frame ',i3,': ',a)",iframe,toplab print,' (cylindrical equidistant global projection)' endif ; cenlon = map.projcen(1) 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_clines = 1.2 & if keyword_set(cgm) then chsize_clines = .9 chsize_range = 1.1 & if keyword_set(cgm) then chsize_range = .8 chsize_clrbar = 1.2 xtitl = 'LONGITUDE (DEG)' & ytitl = 'LATITUDE (DEG)' xticlabs = ['-180','-120','-60','0','60','120','180'] yticlabs = ['-90','-60','-30','0','30','60','90'] xll = .15 & yll = .48 xur = .95 & yur = yll+.5*(xur-xll) ; ; Get field: ; if map.vec ne 1 then begin genglb = getglb(frame.ixfield,map.zp) fminmax, genglb,!imx*!jmx,rmin,rmax,spval if rmin eq 1.e36 and rmax eq -1.e36 then begin print,'>>> no data (array is all special value) (maybe height too high?)' print,'>>> NO PLOT MADE <<<' return endif print,' global min,max=',rmin,rmax if rmin eq rmax then begin print,'>>> pltce: apparent constant value -- no plot made' return endif ; openw,lu,'poten.dat',/get_lun ; writeu,lu,genglb endif else genglb = fltarr(!imx,!jmx) ; for axes contour (nodata) ; ; Get vectors if needed: ; (save magnitudes if needed for ascii data file) ; if map.vec gt 0 then begin logsave = map.log10 map.log10 = 0 case map.iuv of 1: begin un = getglb(ixu,map.zp) vn = getglb(ixv,map.zp) end 2: begin un = getglb(ixui,map.zp) vn = getglb(ixvi,map.zp) end else: begin print,'pltce: bad map.iuv=',map.iuv,' map.vec=',map.vec return end endcase map.log10 = logsave uvmag = fltarr(!imx,!jmx,/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,!imx*!jmx,minmag,maxmag,spval endif if map.vec ne 1 then fglb = genglb else fglb = uvmag ; used in tcursor ; ; Rotate in longitude if necessary (data array and x-axis tic labels): ; if cenlon ne 0. then begin ix0 = ixfind(gcmlon,!imx,0.,5.) ixcen = ixfind(gcmlon,!imx,cenlon,5.) if ixcen lt ix0 then ishift = ix0-ixcen else ishift = -(ixcen-ix0) if map.vec ne 1 then genglb = shift(genglb,ishift,0) if map.vec gt 0 then begin un = shift(un,ishift,0) vn = shift(vn,ishift,0) endif if cenlon ne gcmlon(ixcen) then $ print,' Requested cenlon=',cenlon,' Actual cenlon used=',gcmlon(ixcen) tmplon = fltarr(!imx-1) & for i=0,!imx-2 do tmplon(i) = gcmlon(i) tmplon = shift(tmplon,ishift) shiftlon = fltarr(!imx) & for i=0,!imx-2 do shiftlon(i) = tmplon(i) shiftlon(!imx-1) = shiftlon(0) n = -1 for i=0,!imx-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 else shiftlon = gcmlon if map.vec gt 0 then begin incx = 3 & incy = 2 un(0,*) = spval & un(!imx-1,*) = spval un(*,0) = spval & un(*,!jmx-1) = spval un(where(findgen(!imx) mod incx ne 1),*) = spval un(*,where(findgen(!jmx) 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)+' (M/S)' print,' ',vectitle if map.vmag eq 0. then begin map.vmag = rnd(maxmag,50.) if map.vmag eq 0. then map.vmag = rnd(maxmag,1.) print,' using scale magnitude of ',map.vmag,' m/s' endif endif ; ; Plot and color bar positions: ; fac = 2.5/180.*(yur-yll) & fudge = 2.*fac mappos = [xll-fudge,yll-fudge,xur+fudge,yur+fudge] print,'mappos=',mappos map_set,0.,cenlon,/noborder,/cyl,position=mappos barw = xur-xll & barh = .03 xbar = xll & ybar = yll-barh-.22 ; ; Make image if necessary: ; if (imcon eq 0 or imcon eq 2) and map.vec ne 1 then begin if cont.imapply gt 0 then begin glbimage = bytscl(genglb(*,*),top=!d.table_size-3,$ min=cont.cmin,max=cont.cmax)+1 indx = where(genglb gt cont.cmax or genglb lt cont.cmin, cnt) if cnt gt 0 then begin glbimage(indx) = 0 print,' Removed ',cnt,' points outside cmin,cmax' endif endif else begin glbimage = bytscl(genglb(*,*),top=!d.table_size-3,min=rmin,max=rmax)+1 endelse ; glbimage = bytscl(genglb(*,*),top=!d.table_size-3,min=rmin,max=rmax)+1 indx = where(genglb ge spval/10., cnt) if cnt ne 0 then begin glbimage(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 dev = convert_coord([xll,yll+fac],/norm,/to_device) xll_dev = dev(0) & yll_dev = dev(1) dev = convert_coord([xur,yur-fac],/norm,/to_device) xur_dev = dev(0) & yur_dev = dev(1) ncol = fix(xur_dev+.5)-fix(xll_dev+.5) nrow = fix(yur_dev+.5)-fix(yll_dev+.5)-3 im=congrid(glbimage,ncol,nrow,/interp) fudge = 2.*fac endif else begin ; postscript or cgm: im = rebin(glbimage(*,*),!imx*imscale,!jmx*imscale) fudge = fac endelse endif ; ; Set up contouring cmin,cmax,cint: ; if imcon gt 0 and map.vec ne 1 then begin prntcon = cont.prntcon if keyword_set(cgm) or keyword_set(ps) then prntcon = 0 levels = conspec(genglb,cont.cmin,cont.cmax,cont.cint,cont.nlev,$ prntcon) cont.nlev = n_elements(levels) if cont.nlev le 1 then begin if cont.nlev le 0 then $ print,'>>> pltce: no data (array all special value) -- no frame made' if cont.nlev eq 1 then $ print,'>>> pltce: only one contour level -- 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 $ contitle = '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 $ contitle = '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 ; ; History and model time label: ; histlab = mkhistlab() if map.iht le 0 then histlab = histlab + ' AVEHT=' + $ strcompress(string(ms90_glbmht,format="(f5.1)"),/remove_all) ; ; Color bar dimensions: ; if map.vec ne 1 then begin barmin = rmin & barmax = rmax if cont.imapply gt 0 then begin barmin = cont.cmin barmax = cont.cmax endif barlabs = [strcompress(string(barmin,format="(g10.4)"),/remove_all),$ strcompress(string(0.5*(barmin+barmax),format="(g10.4)"),/remove_all),$ strcompress(string(barmax,format="(g10.4)"),/remove_all)] endif ; ; Draw contours and/or image: ; psx = xur-xll & psy = yur-yll-2.*fac ; postscript sizes conpos = [xll,yll,xur,yur] ; contour axes position print,'conpos=',conpos xyouts,xll+.5*(xur-xll),yur+.04,toplab,/norm,charsize=chsize_toplab,align=.5 xmid = .5*(xll+xur) ;box,/itic ips = 0 if n_elements(ps) gt 0 then ips = ps case imcon of ; ; Image only: ; 0: begin if map.vec ne 1 then begin tv,im,xll,yll+fudge,xsize=psx,ysize=psy,/norm clrbar,barw,barh,xbar,ybar,barlabs,botcolor=1,topcolor=!d.table_size-2,$ charsize=chsize_clrbar endif if continents gt -1 then map_continents,mlinestyle=contline,$ color=continents if mapgrid gt -1 then map_grid,/label,color=mapgrid contour,genglb,gcmlon,gcmlat,/norm,/noerase,/nodata,position=conpos,$ 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 sltxax,ut,shiftlon(0),shiftlon(!imx-1),conpos,.13 if map.vec gt 0 then begin ; image+vectors or vectors only ascy = yll-.32 & if map.vec eq 1 then ascy = yll-.25 gridvec,un,vn,gcmlon,gcmlat,spval=spval,$ position=conpos,map.proj,color=map.vclr,$ scalemag=map.vmag,scalelen=map.vlen,xscale=xmid,yscale=ascy xyouts,xmid,ascy-.08,vectitle,align=.5,/norm,charsize=chsize_range xyouts,xmid,ascy-.13,histlab,align=.5,/norm,charsize=chsize_range endif else $ xyouts,xmid,yll-.35,histlab,align=.5,/norm,charsize=chsize_range end ; ; Contour only: ; 1: begin if continents gt -1 then map_continents,mlinestyle=contline,$ color=continents if mapgrid gt -1 then map_grid,/label,color=mapgrid contour,genglb,gcmlon,gcmlat,/norm,/noerase,/nodata,position=conpos,$ 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 sltxax,ut,shiftlon(0),shiftlon(!imx-1),conpos,.13 yll = yll+fudge & yur = yur-fudge conpos = [xll,yll,xur,yur] if map.vec ne 1 then begin ; plotting contours contour,genglb,gcmlon,gcmlat,/norm,/noerase,/follow,nlevels=cont.nlev,$ position=conpos,xstyle=5,ystyle=5,c_charsize=chsize_clines,$ levels=levels,c_labels=clabels,max_value=spval/10.,$ c_linestyle=clines,c_colors=[cont.conclr] xyouts,xmid,yll-.25,contitle,align=.5,/norm,charsize=chsize_range endif if map.vec gt 0 then begin ; plotting vectors if map.vec eq 1 then begin ; vectors only gridvec,un,vn,gcmlon,gcmlat,spval=spval,$ position=conpos,map.proj,color=map.vclr,ps=ips,$ scalemag=map.vmag,scalelen=map.vlen,xscale=xmid,yscale=yll-.25 xyouts,xmid,yll-.31,vectitle,align=.5,/norm,charsize=chsize_range xyouts,xmid,yll-.37,histlab,align=.5,/norm,charsize=chsize_range endif else begin ; vectors+contours gridvec,un,vn,gcmlon,gcmlat,spval=spval,$ position=conpos,map.proj,color=map.vclr,ps=ips,$ scalemag=map.vmag,scalelen=map.vlen,xscale=xmid,yscale=yll-.28 xyouts,xmid,yll-.34,vectitle,align=.5,/norm,charsize=chsize_range xyouts,xmid,yll-.4,histlab,align=.5,/norm,charsize=chsize_range endelse endif else $ xyouts,xmid,yll-.29,histlab,align=.5,/norm,charsize=chsize_range end ; ; Image + contour ; 2: begin if map.vec ne 1 then begin tv,im,xll,yll+fudge,xsize=psx,ysize=psy,/norm clrbar,barw,barh,xbar,ybar,barlabs,botcolor=1,topcolor=!d.table_size-2,$ charsize=chsize_clrbar endif if continents gt -1 then map_continents,mlinestyle=contline,$ color=continents if mapgrid gt -1 then map_grid,/label,color=mapgrid contour,genglb,gcmlon,gcmlat,/norm,/noerase,/nodata,position=conpos,$ 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 sltxax,ut,shiftlon(0),shiftlon(!imx-1),conpos,.13 yll = yll+fudge & yur = yur-fudge conpos = [xll,yll,xur,yur] if map.vec gt 0 then begin ; doing vectors if map.vec ne 1 then begin ; doing image+contour+vectors xyouts,xmid,yll-.35,histlab,align=.5,/norm,charsize=chsize_range contour,genglb,gcmlon,gcmlat,/norm,/noerase,/follow,nlevels=cont.nlev,$ position=conpos,xstyle=5,ystyle=5,c_charsize=chsize_clines,$ levels=levels,c_labels=clabels,max_value=spval/10.,$ c_linestyle=clines,c_colors=[cont.conclr] xyouts,xmid,yll-.39,contitle,align=.5,/norm,charsize=chsize_range gridvec,un,vn,gcmlon,gcmlat,spval=spval,$ position=conpos,map.proj,color=map.vclr,ps=ips,$ scalemag=map.vmag,scalelen=map.vlen,xscale=xmid,yscale=yll-.41 xyouts,xmid,yll-.47,vectitle,align=.5,/norm,charsize=chsize_range endif else begin ; vectors only gridvec,un,vn,gcmlon,gcmlat,spval=spval,$ position=conpos,map.proj,color=map.vclr,ps=ips,$ scalemag=map.vmag,scalelen=map.vlen,xscale=xmid,yscale=yll-.25 xyouts,xmid,yll-.33,vectitle,align=.5,/norm,charsize=chsize_range endelse endif else begin ; not doing vectors contour,genglb,gcmlon,gcmlat,/norm,/noerase,/follow,nlevels=cont.nlev,$ position=conpos,xstyle=5,ystyle=5,c_charsize=chsize_clines,$ levels=levels,c_labels=clabels,max_value=spval/10.,$ c_linestyle=clines,c_colors=[cont.conclr] xyouts,xmid,yll-.38,contitle,align=.5,/norm,charsize=chsize_range xyouts,xmid,yll-.43,histlab,align=.5,/norm,charsize=chsize_range endelse end else: print,'bad imcon' endcase map_set,0.,cenlon,/noborder,/cyl,position=mappos,/noerase ; ; Write ascii file (if plotted vectors only, write vector magnitudes): ; if writeascii and keyword_set(cgm) le 0 then begin if map.vec ne 1 then $ wrascii,luascii,genglb,!imx,!jmx,shiftlon,gcmlat,xtitl,ytitl,$ tgcmhdr.histvol,fieldlab,ifrdat,toplab,"TGCMIDL" $ else $ wrascii,luascii,uvmag,!imx,!jmx,shiftlon,gcmlat,xtitl,ytitl,$ tgcmhdr.histvol,fieldlab,ifrdat,toplab,"TGCMIDL" endif if keyword_set(cgm) le 0 and writeascii le 0 then begin print,'Completed frame ',iframe iframe = iframe+1 endif return end