pro color_block,indexname,colorname,colblockout
; this routine reads an index file created by basel_index1.pro or 
; color_fillin.pro or color_fillout.pro, and a corresponding colors file
; and makes an array colblock(nc,ntu,nlgu,nlzu) containing all of the colors 
; for each unique combination of teff, logg, logz.  The color block and
; the corresponding unique values of the parameters are written to colblockout.

restore,indexname
restore,colorname

sz=size(indx)
nt=sz(1)
nlg=sz(2)
nlz=sz(3)
sz=size(colors)
nc=sz(1)
colblock=fltarr(nc,nt,nlg,nlz)

for i=0,nlz-1 do begin
  dd=fltarr(nc,nt,nlg)
  for j=0,nt-1 do begin
    for k=0,nlg-1 do begin
      inx=indx(j,k,i)
      if(inx ge 0) then dd(*,j,k)=colors(*,inx)
    endfor
  endfor
  colblock(*,*,*,i)=dd
endfor

save,colblock,teffu,loggu,logzu,file=colblockout

end