Viewing contents of file '../idllib/ghrs/pro/chkref.pro'
pro chkref,rootname,outfile
;+
; CHKREF
;
; List reference files not available for calfos processing.
;
; CALLING SEQUENCE:
; chkref,rootname [,outfile]
;
; INPUT:
; rootname - rootname of GEIS file(s) to be examined; wildcards valid.
; outfile - name of output files containing list of reference files not
; found; '_dat.lis' and '_tab.lis' are appended to the
; supplied name. (default: getref_dat.lis and getref_tab.lis).
;
; OUTPUT:
; reference images and tables not available are listed to the screen and
; to outfile; outfile not created if all files are available or if
; outfile is set to '' (null string).
;
; HISTORY:
; Written 22 June 1990, G. Hartig
; mod to handle new DQI file pair - 24 Aug 90 - GFH
; mod for IDL V2 - 16 Nov 90 - D. Neill
;-
;*******************************************************************************
;
if n_params(0) lt 2 then outfile='chkref'
;
list=findfile(rootname+'.d0h',count=nf)
if nf le 0 then goto,fnf
refs=strarr(20,nf*9)
reft=strarr(20,nf*8)
;
refname=['bachfile','fl1hfile','fl2hfile','iv1hfile','iv2hfile','rethfile', $
'ddthfile','dq1hfile','dq2hfile','ccg2 ','ccs0 ','ccs1 ', $
'ccs2 ','ccs3 ','ccs4 ','ccs5 ','ccs6 ']
nnf=0
ntnf=0
for i=0,nf-1 do begin
fdecomp,list(i),disk,dir,root,ext,ver
fn=disk+dir+root+'.'+ext
sxopen,1,fn,h
for j=0,8 do begin
outfn=outfile+'_dat.lis'
ref=strtrim(sxpar(h,refname(j)),2)
log=getlog(gettok(ref,'$'))
if strupcase(ref) ne 'N/A' then begin
reff=findfile(log+ref,count=nref)
if nref gt 0 then goto,gotit
print,fn+': ',ref,' not in ',log
if outfile ne '' then begin
if nnf eq 0 then begin
openw,2,outfn
refs(0)=strupcase(ref)
printf,2,ref
nnf=1
endif else begin
for n=0,nnf-1 do if strupcase(ref) eq strtrim(refs(n),2) $
then goto,haveit
refs(nnf)=strupcase(ref)
nnf=nnf+1
printf,2,ref
haveit:
endelse
endif
gotit:
endif
endfor ; j
for j=9,16 do begin
outfn=outfile+'_tab.lis'
ref=strtrim(sxpar(h,refname(j)),2)
log=getlog(gettok(ref,'$'))
if strupcase(ref) ne 'N/A' then begin
reff=findfile(log+ref,count=ntab)
if ntab gt 0 then goto, gottab
print,fn+': ',ref,' not in ',log
if outfile ne '' then begin
if ntnf eq 0 then begin
openw,3,outfn
reft(0)=strupcase(ref)
printf,3,ref
ntnf=1
endif else begin
for n=0,ntnf-1 do if strupcase(ref) eq strtrim(reft(n),2) $
then goto,havetab
reft(ntnf)=strupcase(ref)
ntnf=ntnf+1
printf,3,ref
havetab:
endelse
endif
gottab:
endif
endfor ; j
endfor ; i
print,' '
if (nnf+ntnf) gt 0 then begin
if nnf gt 0 then begin
if nnf eq 1 then s='' else s='s'
print, strtrim(string(nnf),2),' missing reference data file'+s+ $
' listed in ',outfile,'_dat.lis'
close,2
endif
if ntnf gt 0 then begin
if ntnf eq 1 then s='' else s='s'
print, strtrim(string(ntnf),2),' missing reference table'+s+ $
' listed in ',outfile,'_tab.lis'
close,3
endif
endif else print,'All reference data files and tables available.'
close,1
return
fnf: print,'No files matching input specification found.'
return
end