; pro pltce,cgm=cgm,ps=ps @pltdat.h ; genglb = frame.zz if map.log10 gt 0 then log10f,genglb,frame.nx*frame.ny,1.e-20,!spval fminmax,genglb,frame.nx*frame.ny,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 ; ; Temp center of proj: ; cenlon = map.projcen(1) ; ; Rotate in longitude if necessary (data array and x-axis tic labels): ; xticlabs = ['-180','-120','-60','0','60','120','180'] if cenlon ne 0. then begin ix0 = ixfind(frame.xx,frame.nx,0.,5.) ixcen = ixfind(frame.xx,frame.nx,cenlon,5.) if ixcen lt ix0 then ishift = ix0-ixcen else ishift = -(ixcen-ix0) genglb = shift(genglb,ishift,0) 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,frame.nx-2 do shiftlon(i) = tmplon(i) shiftlon(frame.nx-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 else shiftlon = frame.xx ; ; Char sizes, labels, tic marks: ; 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 = frame.xlab & ytitl = frame.ylab yticlabs = ['-90','-60','-30','0','30','60','90'] ;xll = .15 & yll = .48 ;xur = .95 & yur = yll+.5*(xur-xll) xll = .15 & yll = .45 xur = .95 & yur = yll+.5*(xur-xll) ; ; Plot and color bar positions: ; 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 barw = xur-xll & barh = .03 xbar = xll & ybar = yll-barh-.22 if map.sltxax le 0 then ybar = ybar+.08 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)] ; ; Make image if necessary: ; if imcon eq 0 or imcon eq 2 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 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(*,*),frame.nx*imscale,frame.ny*imscale) fudge = fac endelse endif ; ; Set up contouring cmin,cmax,cint: ; if imcon gt 0 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 ; ; Draw contours and/or image: ; psx = xur-xll & psy = yur-yll-2.*fac ; postscript sizes conpos = [xll,yll,xur,yur] ; axes position pltpos = [xll,yll+fac,xur,yur-fac] ; contour position xyouts,xll+.5*(xur-xll),yur+.04,frame.infolab,/norm,$ charsize=chsize_toplab,align=.5 xyouts,xll+.5*(xur-xll),yur+.08,frame.toplab,/norm,$ charsize=chsize_toplab,align=.5 xmid = .5*(xll+xur) ;box,/itic botlab = frame.botlab case imcon of ; ; Image only: ; 0: 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 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 contour,genglb,frame.xx,frame.yy,/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 if map.sltxax gt 0 then begin sltxax,ut,shiftlon(0),shiftlon(frame.nx-1),conpos,.13 xyouts,xmid,yll-.33,botlab,align=.5,/norm,charsize=chsize_range endif else $ xyouts,xmid,yll-.25,botlab,align=.5,/norm,charsize=chsize_range end ; ; Contour only: ; 1: begin 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 contour,genglb,frame.xx,frame.yy,/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 yll = yll+fudge & yur = yur-fudge contour,genglb,frame.xx,frame.yy,/norm,/noerase,/follow,$ nlevels=cont.nlev,$ position=pltpos,xstyle=5,ystyle=5,c_charsize=chsize_clines,$ levels=levels,c_labels=clabels,max_value=!spval/10.,$ c_linestyle=clines,c_colors=[cont.conclr] if map.sltxax gt 0 then begin sltxax,ut,shiftlon(0),shiftlon(frame.nx-1),conpos,.13 xyouts,xmid,yll-.25,contitle,align=.5,/norm,charsize=chsize_range xyouts,xmid,yll-.30,botlab,align=.5,/norm,charsize=chsize_range endif else begin xyouts,xmid,yll-.17,contitle,align=.5,/norm,charsize=chsize_range xyouts,xmid,yll-.22,botlab,align=.5,/norm,charsize=chsize_range endelse end ; ; Image + contour ; 2: 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 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 contour,genglb,frame.xx,frame.yy,/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 contour,genglb,frame.xx,frame.yy,/norm,/noerase,/follow,$ nlevels=cont.nlev,$ position=pltpos,xstyle=5,ystyle=5,c_charsize=chsize_clines,$ levels=levels,c_labels=clabels,max_value=!spval/10.,$ c_linestyle=clines,c_colors=[cont.conclr] if map.sltxax gt 0 then begin sltxax,ut,shiftlon(0),shiftlon(frame.nx-1),conpos,.13 xyouts,xmid,yll-.40,botlab,align=.5,/norm,charsize=chsize_range xyouts,xmid,yll-.35,contitle,align=.5,/norm,charsize=chsize_range endif else begin xyouts,xmid,yll-.32,botlab,align=.5,/norm,charsize=chsize_range xyouts,xmid,yll-.27,contitle,align=.5,/norm,charsize=chsize_range endelse end else: print,'bad imcon' endcase if vec.ivec gt 0 then begin ylaboff = .26 if imcon eq 2 then ylaboff = .35 if imcon eq 0 then ylaboff = .28 if map.sltxax gt 0 then begin ylaboff = .36 if imcon eq 2 then ylaboff = .42 endif pltce_vec,conpos,cgm=cgm,ps=ps,ylaboff=ylaboff endif map_set,0.,cenlon,/noborder,/cyl,position=mappos,/noerase if keyword_set(cgm) le 0 and keyword_set(ps) le 0 then begin print,'Completed frame ',iframe iframe = iframe+1 endif return end