PRO PMTRAS_DBASE_SPOTCHECK, dbsolution ; ; Generates a file, PMTRAS_MGR_SPOT.txt, with a list of roll angles at evenly spaced intervals. ; ; 11-Aug-03 gh Initial version ; scinterval = 64*500 ; sctime interval (s) between tabulated data points (must be multiple of 64) scoffset = 64*123 ; sctime offset, relative to n*scinterval, for tabulated data points ; ; Open output file and get current time display. npt = N_ELEMENTS(dbsolution) OPENW, spotfile, 'PMTRAS_MGR_SPOT.txt', /GET_LUN now = SYSTIME() current_time = STRMID(now,8,2)+'-'+STRMID(now,4,3)+'-'+STRMID(now,20,4)+STRMID(now,10,6) ; 'yyyy-mmm-dd hh:mm' ; ; Select data point indices. x = (dbsolution.sctime-scoffset)/FLOAT(scinterval) MOD 1 i = WHERE(x LT 1./scoffset,ni) ; list of sctimes =n*scinterval+scoffset, with integral n IF (ni EQ 0) THEN MESSAGE, 'PMTRAS_DBASE_SPOTCHECK: No data satisfying selection criteria.' i = [0, i, npt-1] ; include first and last points ni = ni+2 ; ; Select data and generate time displays. sctime = dbsolution[i].sctime roll_phase = dbsolution[i].roll_phase*1.E-6 roll_quality = dbsolution[i].roll_quality sc_time = {seconds: 0L, bmicro: 0L} ; define a proper s/c time structure sc_time = REPLICATE(sc_time, ni) sc_time.seconds = sctime showtime = hsi_sctime2any(sc_time, /STIME) ; = array of time-display strings. ; ; Loop to generate output. PRINTF, spotfile, current_time, FORMAT="('PMTRAS_DBASE_SPOTCHECK output generated at ', A17)" PRINTF, spotfile PRINTF, spotfile, 'sctime.seconds --- UT --- qual phase(radians)' PRINTF, spotfile label = REPLICATE(' ', NI+2) label[0] = ' START' label[ni-1] = ' END' FOR j=0, ni-1 DO PRINTF, spotfile, sctime[j], showtime[j], roll_quality[j], roll_phase[j], label[j], $ FORMAT="(I12, 3X, A20, I5, F10.6, A6)" PRINT, ni+6, ' lines written to PMTRAS_MGR_SPOT.txt' CLOSE, spotfile RETURN END