function sza,log,mtime,oldlog ; Test a given test log and mission time, calculate the current rotation period ; and solar zenith angle (using Marty Tomasko's formulas) ; For DISR#2. ; v3 modified to correct Roof 9 data by Lyn ; v4 modified to work on PC 3/9/4 common already_done,doneit,t,t2,in_lock_time,out_of_lock_time,lock_group lost_lock=strarr(100) using=strarr(100) if n_elements(oldlog) eq 0 then goto,initialize if log ne oldlog then goto,initialize if n_elements(doneit) ne 0 then goto,process initialize: ; Does the sun pulse file already exist? fn=findfile(log+'/post/anal_results/sun_pulses') if fn(0) eq '' then list_sun_pulses,log str='' t=dblarr(3,2000) ttemp=dblarr(3) openr,unit,log+'/post/anal_results/sun_pulses',/get_lun readf,unit,str i=0 while not eof(unit) do begin readf,unit,ttemp t(*,i)=ttemp i=i+1 endwhile free_lun,unit t=t(*,0:i-1) t2=reform(t(1,*)) ; Read the message_log to find in-lock and out-of-lock times in_lock_time=dblarr(100) out_of_lock_time=dblarr(100) results='string' openr,ol_in,log+'/message_log',/get_lun halt=0 n_usings=0 while not eof(ol_in) do begin readf,ol_in,results junk=strpos(results,'using_sun_pulses') if junk ne -1 then begin using(n_usings)=results n_usings=n_usings+1 endif endwhile using=using(0:n_usings-1) for i=0,n_usings-1 do begin pieces=strsplit(using(i),'Time: ',/extract,/regex) time_extract,pieces(1),hr,min,sec,ilt in_lock_time(i)=double(ilt) endfor in_lock_time=in_lock_time(0:i-1) openr,ol_in2,log+'/post/anal_results/sun_pulses',/get_lun while not (eof(ol_in2)) do begin readf,ol_in2,results endwhile reads,results,o_time,format='(13x,f12.0)' last_time=o_time+0.01 openr,ol_in3,log+'/message_log',/get_lun halt=0 ll_flag=0 n_lost=0 while not eof(ol_in3) do begin readf,ol_in3,results junk=strpos(results,'SunSensor_sig_lost ') if junk ne -1 then begin ll_flag=1 lost_lock(n_lost)=results n_lost=n_lost+1 endif endwhile lost_lock=lost_lock(0:n_lost-1) if results ne 'code: 55 - SunSensor_sig_lost Id: 99 Time: 00:47:26.3645' and $ n_lost ne 0 then begin k=0 for j=0,(n_usings