function getalt,log,epoch ;This function returns the altitude in KM from the given test log ;at the passed mission time (epoch). The epoch should be in minutes ;after T0. ; mtime = mission time (an array containing the mission time) ; alt = corresponding altitude info from the Science Summary ;if no data is found the program returns altitude = -1. openr,lun,log+'Science_Summary_M',/get_lun time = '' name = '' rest = '' space='' mtime=fltarr(350) alt=fltarr(350) i=0 altitude=-1000. ;if no data is found the program returns -1 ; The first line is different readf,lun,time,name,rest,format ='(a13,a8,a)' goto, start ;___________________________________________________________________ ;read in data from Science_Summary and place in arrays, mtime & alt while not eof(lun) do begin readf,lun,space,time,name,rest,format ='(a1,a13,a8,a)' start: if sstr(name) ne 'Cycle' then goto, next hrs=float(strmid(time,0,2)) min=float(strmid(time,3,2)) sec=float(strmid(time,6,7)) seconds=3600.*hrs+60*min+sec minutes=seconds/60. mtime(i)=minutes n=strpos(rest,'Alt:') alt(i)=float(strmid(rest,n+4,9)) i=i+1 next: endwhile ;___________________________________________________________________ ;clean up data filtzero,mtime,alt,npoints ;eliminate 0,0 data points if npoints eq 0 then begin & print,'No Altitude Data Found' & goto,exit & endif ;sort in ascending order array=fltarr(2,npoints) array(0,*)=mtime array(1,*)=alt col_sort,array,0 mtime=array(0,*) alt=array(1,*) ;___________________________________________________________________ ;interpolate within these arrays to get the actual altitude at the epoch. if epoch gt max(mtime) or epoch lt min(mtime) then $ print,'* WARNING * getalt.pro must extrapolate to determine altitude at time: ',sstr(epoch) altitude=interpol(alt,mtime,epoch) exit: close,lun return,altitude/1000 end