;+ ; NAME: ; smei_TimePosn ; PURPOSE: ; Dissect name of SMEI-related file ; CATEGORY: ; camera/idl/toolbox ; CALLING SEQUENCE: FUNCTION smei_TimePosn, files, $ camera = camera , $ id = id , $ time = time , $ format = format , $ extract = extract ; INPUTS: ; files array; type: string ; list of file names. Only the name part is ; analyzed, i.e. directory and extension are ; ignored ; OUTPUTS: ; pos array: type: integer ; start position of time in 'names'; ; -1 if no time is found ; OPTIONAL OUTPUT PARAMETERS: ; camera=camera array; type; integer ; camera number ; id = id array; type: string ; string id of SMEI file type, e.g. 'm0','m1','m2','sky',etc. ; time=time array; type: time structure ; time extracted from file name ; format=format array; type: string ; format used to extract time ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; GetFileSpec, SyncArgs, strposn, TimePosn ; PROCEDURE: ; MODIFICATION HISTORY: ; JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- ; Takes care of double extensions like .buf.gz InitVar, extract, /key names = GetFileSpec(files, part='name') names = GetFileSpec(names, part='name') pos = TimePosn(names, front=id, time=time, format=format) camera = 0 SyncArgs, names, camera n = where(pos NE -1) IF n[0] NE -1 THEN BEGIN prefix = '_tmp_' i = where(strpos(id[n],prefix) EQ 0) IF i[0] NE -1 THEN id[n[i]] = strmid(id[n[i]],strlen(prefix)) c = strmid(id[n],0,2) i = where(c EQ 'c1' OR c EQ 'c2' OR c EQ 'c3', complement=j) IF j[0] NE -1 THEN BEGIN j = j[n] pos[j] = -1 id [j] = '' ENDIF IF i[0] NE -1 THEN BEGIN i = n[i] camera[i] = fix(strmid(id[i],1,1)) n = strposn(strmid(id[i],2),'_',front,/last) id[i] = front ENDIF ENDIF IF extract THEN pos = time RETURN, pos & END