pro secchi_fix_checksum,schfile,outfile ;+ ; $Id: secchi_fix_checksum.pro,v 1.1 2022/05/15 19:38:45 mcnutt Exp $ ; ; Project : SECCHI ; ; Name : secchi_fix_checksum ; ; Purpose : to correct secchi schedule files checksums values ; ; Explanation : ; ; Use : IDL> secchi_fix_checksum,schfile,outfile ; ; Inputs : schfile to corrects name ; ; Outputs : corrected sch file ; ; Keywords : ; ; Common : ; ; Restrictions: ; ; Side effects: if outfile is not set the input file will be overwritten. ; ; Category : Planning ; ; Prev. Hist. : None. ; ; Written : Lynn Hutting 09/10/2015 ; ; Modified : ; ; $Log: secchi_fix_checksum.pro,v $ ; Revision 1.1 2022/05/15 19:38:45 mcnutt ; fix checksum without calling fix_schedule ; if datatype(outfile) eq 'UND' then outfile=schfile lines=readlist(schfile) openw,fsum,outfile,width=120,/get_lun for n=0,n_Elements(lines)-1 do begin if strpos(lines[n],"#") ne 0 then begin linep1=strmid(lines[n],0,14);+string(strlen(lines[n]),'(Z2.2)') if strlen(lines[n]) ge 15 then linep2=strmid(lines[n],16,strlen(lines[n])-14) else linep2='' line=linep1+string(((total(byte(linep1))+total(byte(linep2))) mod 256),'(Z2.2)')+linep2 endif else line=lines[n] printf,fsum,line endfor close,fsum free_lun,fsum end