;+ ; NAME mk3_time.pro ; ; PURPOSE Compute Mk3 time for a given angular position. ; ; SYNTAX mk3_time, fits_file, position_angle ; fits_file Name fo Mk3 FITS file [rpb format]. ; position_angle Position angle [degrees CCW from solar north]. ; ; EXAMPLE mk3_time, '19960524.1812.mk3.rpb.fts', 30.0 ; ; ORIG. AUTHOR Alice Lecinski HAO/NCAR 28 Jan 1999 [rpBtimepos.pro] ; ; HISTORY Andrew L. Stanger HAO/NCAR ; 17 Jul 2003 : [ALS] Adapt for Mk3 FITS format. ;- PRO mk3_time, fits_file, position_angle hdu1 = headfits (fits_file) time_obs = fxpar (hdu1, 'TIME-OBS') duration = fxpar (hdu1, 'SCAN-DUR') ; Scan duration [seconds]. scan_dir = fxpar (hdu1, 'SCAN-DIR') ; Scan direction [CW-, CCW+] pangle = fxpar (hdu1, 'SOLAR_P0') ; P-angle [degrees] ;phase = fxpar (hdu1, 'PHASE') phase = -30.0 tmin = fxpar (hdu1, 'TMIN') ; Start barrel angle [degrees] tmax = fxpar (hdu1, 'TMAX') ; Stop barrel angle [degrees] scan_dir = STRTRIM (scan_dir, 2) ; Eliminate any "blanks/spaces". ang_range = ABS (tmax - tmin) ; --- Convert observation time into seconds. time = DOUBLE (STR_SEP (time_obs, ':')) obs_sec = time [0] * 3600 + time [1] * 60 + time [2] ; --- Compute angle with respect to scan start position. IF (scan_dir EQ "CW") THEN $ ang = 360 - (position_angle - 180 + pangle + phase) IF (scan_dir EQ "CCW") THEN $ ang = (position_angle - 180 + pangle + phase) IF (ang LT 0.0) THEN ang = ang + 360.0 IF (ang GT 360.0) THEN ang = ang - 360.0 ang_frac = ang / ang_range angtime = obs_sec + (duration * (ang_frac)) hour = FIX (angtime / (60.0 * 60.0)) minute = FIX (angtime / (60.0) - hour * 60.0) second = FIX (angtime - ((hour * 60.0 + minute) * 60.0)) sangtime = STRING (hour, minute, second, FORMAT="(i2.2, ':', i2.2, ':', i2.2)") print, sangtime END