Viewing contents of file '../idllib/ghrs/pro/comp_geis.pro'
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+
;
;*NAME:
; COMP_GEIS
;
;*CLASS:
;
;*CATEGORY:
;
;*PURPOSE:
; Compare GEIS files (i.e. compare version 1 and 2 files)
;
;*CALLING SEQUENCE:
; comp_geis, filespec, dir1, dir2
;
;*PARAMETERS:
; INPUT:
; filespec - input file specifcation(i.e. z0ls*)
; dir1 - directory path name containing IDL V1 GEIS files
; dir2 - directory path name containing IDL V2 GEIS files
;
;*EXAMPLES:
; comp_geis,'z0ls*','lasp$scratch:[hrsdata.v1]','weekly$scratch:[hrs.v2]'
;
;*NOTES:
; If !textout=3, the routine directs the output to file named
; COMP_GEIS.PRT.
;
;*MODIFICATION HISTORY:
; 26-jun-1991 JKF/ACC - for IDL V2
; 27-may-1992 JKF/ACC - changed decompose to fdecomp.
;
;-
;-------------------------------------------------------------------------------
pro comp_geis, filespec, dir1, dir2
if n_params(0) lt 1 then $
message,'comp_geis,filespec,dir1,dir2'
textopen,'comp_geis'
fdecomp, filespec, disks, devs, fil_sp, ext, ver
fdecomp, dir1, disk1, dev1, d1, ext1, ver1
fdecomp, dir2, disk2, dev2, d2, ext2, ver2
; determine number of files to be compared...used 1st directory
list1= findfile( disk1 + dev1 + fil_sp + '.*h', count=count)
if count eq 0 then $
message,' Unable to locate input filespec: '+ disk1 + dev1 + fil_sp + '.*h'
list2= findfile( disk1 + dev1 + fil_sp + '.*h', count=count)
printf, !textunit, ' GEIS COMPARE of ', n_elements(list1),' files'
printf, !textunit, ' Input files located in ', disk1+dev1, ' and ',disk2+dev2
printf, !textunit,' '
for i = 0L, n_elements( list1)-1 do begin
fdecomp,list1(i), dk, dev, n1, ext1, ver
fdecomp,list2(i), dk, dev, n2, ext2, ver
sxopen, 1, disk1 + dev1 + n1 +'.'+ ext1, h1
sxopen, 2, disk2 + dev2 + n2 +'.'+ ext2, h2
printf,!textunit,' '
printf,!textunit,' COMPARING FILES FOR : '+N1+'.'+EXT1
;
; Compare the headers
;
dif_head = where( h1 ne h2, found)
if found ne 0 then begin
printf,!textunit,' Differences found in header record: ',found
for j=0,n_elements(found)-1 do begin
printf,!textunit,h1(dif_head(j))
printf,!textunit,h2(dif_head(j))
printf,!textunit,' '
end
end else $
printf,!textunit,' No differences found in header '
;
; Compare the data records
;
gpar = sxpar(h1,'gcount') ; are there any groups
;
; 1) Look for # of groups
;
if gpar gt 0 then begin
if !debug then print, gpar, ' groups found '
npar = sxpar(h1,'pcount')
;
; 2) Check for group parameters
;
if npar gt 0 then par_flg= 1 else par_flg= 0
for ii = 0, gpar-1 do begin
if (not(par_flg)) then begin
d1 = sxread(1,ii)
d2 = sxread(2,ii)
end else begin
if !debug then print, npar,' parameters found '
d1= sxread(1,ii,par1)
d2= sxread(2,ii,par2)
for jj=1,npar do begin
ptype = sxpar(h1,'ptype'+strtrim(jj,2))
tmp1= sxgpar( h1,par1, ptype)
tmp2= sxgpar( h2,par2, ptype)
if tmp1 ne tmp2 then begin
printf,!textunit, $
"Differences found "+ptype
printf,!textunit, tmp1 , $
' vs ', tmp2
if !debug then stop
end
end
printf,!textunit,' Finished with group parameters ', $
'for group ',ii
end
;
; Now, compare the data for that a GROUP
;
if !debug then print,' Comparing data for '+ n1+'.'+ext1
dif = where( d1 ne d2,dcount)
if dcount ne 0 then begin
printf,!textunit, $
" Differences found in data for GROUP ", ii
printf,!textunit,' # of differences = ',dcount
if !debug then stop
end else $
printf,!textunit,' No differences found in data'
end
end else begin
;
; Only 1 group
;
d1= sxread(1)
d2= sxread(2)
dif= where(d1 ne d2,dcount)
if dcount ne 0 then begin
printf,!textunit,' '
printf,!textunit,' Differences found in data (single group)'
printf,!textunit,' # of differences = ',dcount
end else $
printf,!textunit,' No differences found in data'
endelse
printf,!textunit,string(replicate(42b,79))
endfor
return
end