;+ ; NAME: ; smei_buf_splitfile ; PURPOSE: ; Analyze content of 256-ascii file header in SMEI L1A *.buf file ; CATEGORY: ; camera/idl/buf ; CALLING SEQUENCE: FUNCTION smei_buf_splitfile, byte_hdr ; INPUTS: ; ascii_hdr array[256]; type: byte ; 256-byte header ; OUTPUTS: ; Result array[1]; type: smei_buf_hdr structure ; INCLUDE: @compile_opt.pro ; On error, return to caller ; EXTERNAL: ; smei_buf_hdr__define ; CALLS: ; GetFileSpec, timeposn, TimeSet, TimeOp ; PROCEDURE: ; The file header is actually stored in ascii form, so the input byte ; array is converted to string before processing ; MODIFICATION HISTORY: ; MAR-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Based on SMEI Convert 1.0 ;- ascii_hdr = string(byte_hdr) hdr = {smei_buf_hdr} hdr.l1a_file = strtrim( strmid(ascii_hdr, 0, 60) ) hdr.tlm_file = strtrim( strmid(ascii_hdr, 60, 60) ) hdr.type = strtrim( strmid(ascii_hdr,120, 4), 2 ) hdr.bitpix = fix ( strmid(ascii_hdr,124, 4) ) hdr.mode = fix ( strmid(ascii_hdr,128, 2) ) hdr.full_frame = fix ( strmid(ascii_hdr,130, 2) ) hdr.total_frames= long ( strmid(ascii_hdr,132, 6) ) hdr.start_ut = double ( strmid(ascii_hdr,138, 15) ) hdr.stop_ut = double ( strmid(ascii_hdr,153, 15) ) hdr.year = fix ( strmid(ascii_hdr,168, 5) ) hdr.day = fix ( strmid(ascii_hdr,173, 4) ) hdr.hour = fix ( strmid(ascii_hdr,177, 3) ) hdr.minute = fix ( strmid(ascii_hdr,180, 3) ) hdr.seconds = float ( strmid(ascii_hdr,183, 6) ) hdr.version = strtrim( strmid(ascii_hdr,189, 30), 2 ) hdr.filler = strtrim( strmid(ascii_hdr,219, 37) ) catch, error CASE error EQ 0 OF 0: hdr = hdr.l1a_file 1: BEGIN ; l1a_2005_001_121212_121212 ; <---- ut -----> <-dd-> ff = GetFileSpec(hdr.l1a_file, part='name', /strict) pp = timeposn(ff,time=ut,length=length) dd = TimeSet(strmid(ff,pp+length+1),format='hhmmss') hdr.ut_start = ut hdr.ut_stop = TimeOp(/add,ut,dd) hdr.duration = dd END ENDCASE catch, /cancel RETURN, hdr & END