PRO PMTRAS_DBASE_GAPS, dbsolution, gapmin ; ; Summaries gaps > gapmin in an ascii file, PMTRAS_DBASE_GAPS.txt. ; Criteria for good data is roll_quality GE 216. ; ; 11-Aug-03 gh Initial version ; 12-Aug-03 gh Clean up handling of initial and final data points. ; Change output filename to ROLL_DBASE_GAPS.txt. ; ; ; Open output file and create time display strings. npt = N_ELEMENTS(dbsolution) sc_event_time = {seconds: 0L, bmicro: 0L} ; define a proper s/c time structure sc_event_time = REPLICATE(sc_event_time, npt) sc_event_time.seconds = dbsolution.sctime showtime = hsi_sctime2any(sc_event_time, /STIME) ; = array of time-display strings. ; igood = WHERE(dbsolution.roll_quality GE 216, ngood) IF (ngood LT 2) THEN BEGIN PRINTF, dbmgapfile, 'PMTRAS_DBASE_GAPS: No output since only ', ngood, 'data points.' RETURN ENDIF gapmin = gapmin > 66 scgoodtime = dbsolution[igood].sctime showgoodtime = showtime[igood] dt = SHIFT(scgoodtime, -1) - scgoodtime ; should be > 0 i = WHERE ((dt[0:ngood-2] LT 63) OR (dt[0:ngood-2] GE gapmin), ngap) ngaptot = ngap ; ; Process start of file OPENW, dbmgapfile, 'ROLL_DBASE_GAPS.txt', /GET_LUN PRINTF, dbmgapfile, gapmin, FORMAT="('LISTING OF ROLL DATABASE GAPS >', I5, ' SECONDS')" 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' PRINTF, dbmgapfile, current_time, FORMAT="(' generated ', A17)" PRINTF, dbmgapfile PRINTF, dbmgapfile, showtime[0], FORMAT="(A20, 32X, 'START')" nline = 4 dt0 = scgoodtime[0] - dbsolution[0].sctime IF dt0 GE gapmin THEN BEGIN PRINTF, dbmgapfile, showtime[0], showgoodtime[0], dt0, $ FORMAT="(A20, ' to ', A20, I7, ' second gap')" nline = nline + 1 ngaptot = ngaptot + 1 ENDIF ; ; Mid file processing IF (ngap GT 0) THEN FOR j = 0L, ngap-1 DO $ PRINTF, dbmgapfile, showgoodtime[i[j]], showgoodtime[i[j]+1], dt[i[j]], $ FORMAT="(A20, ' to ', A20, I7, ' second gap')" nline = nline + ngap ; ; Finish up. dtlast = dbsolution[npt-1].sctime - scgoodtime[ngood-1] IF dtlast GE gapmin THEN BEGIN PRINTF, dbmgapfile, showtime[npt-1], showgoodtime[ngood-1], dtlast, $ FORMAT="(A20, ' to ', A20, I7, ' second gap')" nline = nline + 1 ngaptot = ngaptot + 1 ENDIF nreq = (dbsolution[npt-1].sctime - dbsolution[0].sctime)/64 + 1 percent_gaps = 100. - FLOAT(ngood)/nreq*100. PRINTF, dbmgapfile, showtime[npt-1], FORMAT="(A20, 32X, 'END')" PRINTF, dbmgapfile PRINTF, dbmgapfile, ngaptot, FORMAT="(I8, ' gaps.')" PRINTF, dbmgapfile, ngood, FORMAT="(I8, ' good data points.')" PRINTF, dbmgapfile, npt, FORMAT="(I8,' total data points.')" PRINTF, dbmgapfile, nreq, FORMAT="(I8, ' required data points.')" PRINTF, dbmgapfile, percent_gaps, FORMAT="(F8.1, ' percent gaps.')" CLOSE, dbmgapfile nline = nline + 7 PRINT, nline, ' lines written to ROLL_DBASE_GAPS.txt.' RETURN ENDse matching tolerance (10 arcmin)