; This program can convert f channel data from compressed to uncompressed ; and vice-versa Scott Lasica - 1/10/95 pro f_convert filename='' new_file='' type='' read,'Enter the name of the file you wish to convert: ',filename openr,unit,filename,/get_lun AGAIN: read,'(C)ompress or (D)ecompress this file? ',type type=strupcase(type) if type ne 'C' and type ne 'D' then begin ; the user has not entered a valid response ; print,'' print,'I do not understand your request, please enter again.' print,'' goto,again endif offset=0L read,'Enter the name of the file to be created: ',new_file openw,wunit,new_file,/get_lun,/stream if type eq 'D' then begin print,'' print,'Decompressing file: ',filename print,'' while NOT EOF(unit) do begin record=assoc(unit,bytarr(546)) ;assume byte data type record=record(offset) offset=offset+1 ; convert the data, not the fiducials temp_data = record(18:545) decomp_f,temp_data,decomp_data ; decomp_f returns type int record=fix(record) ; need type int now for uncompressed data record(18:545)=decomp_data writeu,wunit,record endwhile endif else begin print,'' print,'Compressing file: ',filename print,'' while NOT EOF(unit) do begin record=assoc(unit,intarr(546)) ; assume int data type record=record(offset) offset=offset+1 ; convert the data, not the fiducials temp_data=record(18:545) comp_f,temp_data,comp_data ; comp_f returns type byte record=byte(record) ; need type byte now for compressed data record(18:545)=comp_data writeu,wunit,record endwhile endelse print,'' print,'Wrote file: ',new_file print,'' end