PRO PMTRAS_DBASE_VERIFICATION, tstart, duration, DIAG=diag, DBSOLUTION = dbsnew ; ; Regenerates the database solution using short intervals and compares it ; to the pre-existing solution for 'duration' minutes beginning at tstart. ; ; /DIAG will generate pmtras diagnostic plots. ; ; 15-Oct-03 gh Initial version ; 16-oct-03 gh Output written to pmtras_dbase_verification.txt. ; 28-Jun-05 gh Add documentation to code and output file. ; 29-Jun-05 gh DBSOLUTION specifies a structure with the new solution ; ; Open the output text file and print a header line. OPENW, logunit, 'pmtras_dbase_verification.txt', /GET_LUN PRINTF, logunit, ' PMTRAS_DBASE_VERIFICATION OUTPUT' PRINTF, logunit PRINTF, logunit, ' Date Time sctime Qold Qnew dphz(urad) (1arcmin=291)' PRINTF, logunit nline = 4 ; ; Regenerate the database solution with short intervals as dbsnew. ; DEFAULT, diag, 0 IF diag NE 0 THEN diag = -1 PMTRAS_DBASE_GENERATOR, tstart, duration, DBSOLUTION=dbsnew, /SHORT, /NOLOG, PMTRAS_DIAGNOSTIC=diag ; ; Retrieve the pre-existing solution from existing roll data base as dbsold ; obs_time_interval = anytim(tstart) +[0.D, duration*60.D] o = hsi_roll_db() dbsold = o->getdata(obs_time_interval=obs_time_interval) ; ; Compare old and new phases for cases where new data quality is good ; oknew = WHERE (dbsnew.roll_quality GE 192, noknew) ; New database indices where quality is ok. t = {seconds:0L, bmicro:0L} t = REPLICATE(t, noknew) t.seconds = dbsnew[oknew].sctime timelabel = hsi_sctime2any(t,/ECS) FOR i = 0, noknew-1 DO BEGIN ; Loop over good new database times. k = oknew[i] j = WHERE(dbsold.sctime EQ dbsnew[k].sctime, nj) ; Find time match in existing database (--> index, j) IF nj EQ 0 THEN BEGIN ; No time match in existing database PRINTF, logunit, timelabel[i], dbsnew[k].sctime, ' --', FORMAT='(A19, 2X, I12, A5)' nline = nline+1 ENDIF IF nj EQ 1 THEN BEGIN IF dbsold[j].roll_quality LT 192 THEN BEGIN ; If existing database quality was no good PRINTF, logunit, timelabel[i], dbsnew[k].sctime, dbsold[j].roll_quality, dbsnew[k].roll_quality, ' xxxxx', $ FORMAT='(A19, 2X, I12, 2I5, A9)' nline = nline+1 ENDIF ELSE BEGIN dphase = ABS(dbsnew[k].roll_phase - dbsold[j].roll_phase)*1.E-6 ; Phase difference in radians IF dphase GT !PI THEN dphase = 2*!PI - dphase dphase = LONG(dphase*1.E6) ; Phase difference in microradians PRINTF, logunit, timelabel[i], dbsnew[k].sctime, dbsold[j].roll_quality, dbsnew[k].roll_quality, dphase, $ FORMAT='(A19, 2X, I12, 2I5, I9)' nline = nline+1 ENDELSE ENDIF ENDFOR PRINT, nline, ' lines written to pmtras_dbase_verification.txt' CLOSE, logunit STOP end