pro plot_tm5,globgrid=globgrid,$ ;following are all optional dx=dx,dy=dy,$ ;grid spacing log=log,$ ;use log scale in plot noplot=noplot,$ ;set if you want an external program to call and have a multi-page plots sitearr=sitearr,$ ;if sites are in the ccg database will find the lat and lon automatically siteposarr=siteposarr,sitenamearrr=sitenamearr,$ ;if not, then use these two. sitename is not required for sitepos to work charsize=charsize,symsize=symsize,$ cbartitle=cbartitle,plottitle=plottitle,cbarfmt=cbarfmt,nobar=nobar,$ ;titles for the whole plot and the colorbar; and format (e.g. cbarfmt='(F7.2)') sitelabelcol=sitelabelcol,sitesym=sitesym,$ ;color and shape for the site name and marker (uses fanning symcat def; can be array or scalar) directcol=directcol,directlabels=directlabels,$ ;directcol indicates discrete color coding in the map; directlabels is a strarr of the colorlables for such coldiv=coldiv,$ ;coldiv are the color divisions you want -- does not have to be linear. color_mapfill will calculate automatically if not set limit=limit,region=region,$ ;limit is the limit keyword for mapset; alternatively, 'region' can be set; see map_region.pro for options (e.g. region='usa') hires=hires,$ ;option for hi-resolution coast lines coltab=coltab,brewer=brewer,reverse=reverse,$ ;keywords for setting the color table using cgloadct. Use xcolors to see options. nogrid=nogrid,$ ;don't plot gridlines on the map position=position,cbarposition=cbarposition,vertbar=vertbar,$ name=name ;projection name ;plot maps of tm5/ct or other gridded output (can be mixing ratios, fluxes or other) ;input globgrid should be array of 360 x 180, unless dx and dy are something other than 1. if not keyword_set(dx) then dx=1. if not keyword_set(dy) then dy=dx nx=360./dx & ny=180./dy globgrid=reform(globgrid) sz=size(globgrid) if not (sz[0] eq 2 and sz[1] eq nx and sz[2] eq ny) then stop,'Globgrid and/or dx, dy dimensions not correct' ;set colortable ;for 'direct'/discrete colortable options see below for default if not keyword_set(reverse) then reverse=0 if not ccg_vdef(coltab) then coltab=33 if not ccg_vdef(brewer) then brewer=0 coltab=coltab & brewer=brewer & reverse=reverse ;set some parameters if not keyword_set(max) then max=max(globgrid) ;ccg_round(max(globgrid),-1) if not keyword_set(plottitle) then plottitle=' ' if not keyword_set(cbartitle) then cbartitle=' ' lonarr=findgen(360./dx)-180.+dx/2. latarr=findgen(180./dy)-90+dy/2. ;if (not keyword_set(position) and not keyword_set(noplot)) then position=[0.1,0.15,0.9,0.9] if not keyword_set(position) then position=[0.1,0.15,0.9,0.9] if not keyword_set(cbarposition) then cbarposition=[0.1,0.10,0.9,0.14] if keyword_set(vertbar) then begin position=[0.04,0.05,0.85,0.95] cbarposition=[0.89,0.05,0.92,0.95] endif arr=globgrid ;regions, if defined. if no specific region is called, globe is default map_region,region=region,$ limit=limit,p0lat=p0lat,p0lon=p0lon,USA=USA,isotropic=isotropic,horizon=horizon,name=name if not ccg_vdef(noplot) then ps_start ;draw map adv=(!p.multi[1]*!p.multi[2] gt 1) map_set,p0lat,p0lon,name=name,limit=limit,advance=adv,isotropic=isotropic,horizon=horizon,title=titletext,position=position map_continents,fill_continents=1,color=cgcolor('blk3'),hires=hires ;try moving this to colormapfill ;cgloadct,coltab,reverse=reverse,brewer=brewer ;use discrete colortable if called for if keyword_set(directcol) then begin colorarr=['sky blue','grn8','lime green','olive drab','pale green','forest green',$ 'rosy brown','tan4','grn2','gold','tan','blue','ryb4','red','dark khaki','purple','ygb4','pbg7','green','yellow','blk4',$ 'plum','orange','ryb7','navy','red4','cyan','crimson','ygb1','lime green','green'] zz=where(finite(arr) eq 1) ids=uniq(arr[zz],sort(arr[zz])) directs=arr[zz[ids]] ncolors=n_elements(directs) if keyword_set(coldiv) then ncolors=n_elements(coldiv) a=cgcolor(colorarr[0:ncolors-1],indgen(ncolors)) endif color_mapfill, arr=arr,min=0.,max=max,coldiv=coldiv,dx=dx,dy=dy,directcol=directcol,log=log,$ coltab=coltab,reverse=reverse,brewer=brewer ctload,0 map_continents,/countries,/coasts,usa=usa,thick=2,hires=hires if ~keyword_set(nogrid) then map_grid,charsize=1.3,label=1,latlab=limit[1],lonlab=limit[2],/box_axes ;plot out sites if sitearr or (siteposarr and sitenamearr) are passed in if ~keyword_set(sitesym) then sitesym=16 if ~keyword_set(sitelabelcol) then sitelabelcol='black' if keyword_set(sitearr) then begin nsites=n_elements(sitearr) ;convert sitelabelcol and sitesym to arrays if necessary if size(sitelabelcol,/n_dimensions) eq 0 then sitelabelcol=replicate(sitelabelcol,nsites) if size(sitesym,/n_dimensions) eq 0 then sitesym=replicate(sitesym,nsites) for i=0,nsites-1 do begin ccg_siteinfo,site=sitearr[i],res cgplots,res.lon,res.lat,psym=sitesym[i],symsize=symsize,noclip=0,thick=8.,color=sitelabelcol[i] xyouts,res.lon-1,res.lat+1,strupcase(sitearr[i]),/data,charsize=charsize,color=cgcolor(sitelabelcol[i]),charthick=4 endfor endif if keyword_set(siteposarr) then begin nsites=n_elements(siteposarr[*,0]) ;convert sitelabelcol and sitesym to arrays if necessary if size(sitelabelcol,/n_dimensions) eq 0 then sitelabelcol=replicate(sitelabelcol,nsites) if size(sitesym,/n_dimensions) eq 0 then sitesym=replicate(sitesym,nsites) for i=0,nsites-1 do begin cgplots,siteposarr[i,0],siteposarr[i,1],psym=sitesym[i],symsize=symsize,noclip=0,thick=8.,color=sitelabelcol[i] if keyword_set(sitenamearr) then $ xyouts,siteposarr[i,0]+1,siteposarr[i,1]+1,strupcase(sitenamearr[i]),/data,charsize=charsize,color=cgcolor(sitelabelcol[i]) endfor endif ;draw color bar if not keyword_set(nobar) then begin if not keyword_set(coldiv) then coldiv=coldiv ;cbposition=[!x.window[0],!y.window[0]-0.08,!x.window[1],!y.window[0]-0.05] if not keyword_set(directcol) then begin if not keyword_set(cbarfmt) then cbarfmt='(f7.3)' n=n_elements(coldiv)-1 ctload,coltab,reverse=reverse,brewer=brewer,ncolors=n cgcolorbar,divisions=n,ncolors=n,$ ;ncolors=255 ;position=cbposition,$ position=cbarposition,$ ;charsize=1.,ticknames=[' ',string(format=cbarfmt,coldiv[1:*])],minor=0,color=cgcolor('black',255) charsize=1.3,ticknames=[string(format=cbarfmt,coldiv)],minor=0,$ ;,color=cgcolor('black',255) vertical=vertbar, right=vertbar endif else begin ;now redefine ncolors from output of color_mapfill a=cgcolor(colorarr[0:ncolors-1],indgen(ncolors)) cgDCBar, NCOLORS=ncolors, BOTTOM=0,$ position=position,$ LABELS=directlabels,rotate=45 endelse ctload,0 title=cbartitle x0=cbarposition[0] & x1=cbarposition[2] y0=cbarposition[1] & y1=cbarposition[3] xyouts,(x0+x1)/2.,y0-0.08,title,/normal,ali=0.5,charsize=1.3 ;xyouts,mean(!x.window),!y.window[0]-0.15,title,/normal,ali=0.5,charsize=1 ; x0=!x.window[0] & x1=!x.window[1] ; xdel=x1-x0 ; y0=!y.window[0] & y1=!y.window[1] ; ydel=y1-y0 endif if keyword_set(plottitle) then $ xyouts,mean(!x.window),!y.window[1]+0.05,plottitle,/normal,ali=0.5,charsize=1 if not ccg_vdef(noplot) then ps_end end