SUBROUTINE VGTXYZ ( * * inputs * : INFILE, DIM, * * outputs * : MJD, XYZ, NPTS, STAT) * * Module number: * * Module name: * * Keyphrase: * ---------- * read coordinates from the state vector table which is a text file * * Description: * ------------ * read time and coordinate X, Y, Z, from the state vector text file. convert * time from the yyyy.ddd:hh:mm:ss format to MJD (Modified Julian day). * * FORTRAN name: VGTXYZ.FOR * * Keywords of accessed files and tables: * -------------------------------------- * Name I/O Description / Comments * * Subroutines Called: * ------------------- * CDBS: * VSMSJD * SDAS: * UMSPUT, UUOSFN * Others: * None * * History: * -------- * Version Date Author Description * 1 02-28-88 J.-C. HSU coding * *------------------------------------------------------------------------------- * *== input: * --iraf file name of the state vector * --table CHARACTER*(*) INFILE * --dimension of output MJD and XYZ INTEGER DIM * *== output: * --time DOUBLE PRECISION MJD(1), * --rectangular coordinates : XYZ(3, 1) * --number of valid lines in the input * --state vector table INTEGER NPTS, * --error status : STAT * *== local: * INTEGER YEAR, DAY, HOUR, MIN, NLINES, STATOK REAL SEC DOUBLE PRECISION X, Y, Z CHARACTER*8 CHAR8 * --host system file name CHARACTER*128 FNAME CHARACTER*130 CONTXT, MESS * *------------------------------------------------------------------------------ *=========================begin hsp.inc========================================= * --status return code INTEGER OK, ERRNUM(20) INTEGER DEST, PRIO DATA OK /0/ DATA ERRNUM /701, 702, 703, 704, 705, 706, 707, 708, 709, 710, : 711, 712, 713, 714, 715, 716, 717, 718, 719, 720/ * --message destination and priority DATA DEST, PRIO /1, 0/ *=========================end hsp.inc=========================================== * * translate from iraf file name to host system name * CALL UUOSFN (INFILE, FNAME, STAT) IF (STAT .NE. OK) THEN CONTXT = 'cannot translate input iraf file name' GO TO 999 END IF * * open the input text file * OPEN (11, FILE = FNAME, STATUS = 'OLD', IOSTAT = STAT) IF (STAT .NE. 0) THEN CONTXT = 'cannot open the state vector file' STAT = ERRNUM(1) GO TO 999 END IF * * read the file till EOF * NLINES = 0 NPTS = 0 * 10 READ (11, 100, END = 30, ERR = 20) YEAR, DAY, HOUR, MIN, SEC, : X, Y, Z NLINES = NLINES + 1 NPTS = NPTS + 1 * * if the table has more data than the declared space, neglect the rest of data * IF (NPTS .GT. DIM) THEN WRITE (CHAR8, '(I8)') NPTS CONTXT = 'VGTXYZ: input state vector table has more than ' : // CHAR8 // ' lines' CALL UMSPUT (CONTXT, DEST, PRIO, STATOK) GO TO 30 END IF * CALL VSMSJD (YEAR, DAY, HOUR, MIN, SEC, MJD(NPTS)) XYZ(1, NPTS) = X XYZ(2, NPTS) = Y XYZ(3, NPTS) = Z * * read more data * GO TO 10 * * if error during reading the state vector table * 20 NLINES = NLINES + 1 WRITE (CHAR8, '(I8)') NLINES CONTXT = 'VGTXYZ: error reading state vector table at line ' : // CHAR8 CALL UMSPUT (CONTXT, DEST, PRIO, STATOK) GO TO 10 * 30 CLOSE (11) * IF (NPTS .EQ. 0) THEN CONTXT = 'no valid state vector data' STAT = ERRNUM(1) GO TO 999 END IF * 100 FORMAT (1X, I4, 1X, I3, 2(1X, I2), 1X, F6.3, 3(F11.4)) * GO TO 1000 * 999 MESS = 'VGTXYZ: ' // CONTXT CALL UMSPUT (MESS, DEST, PRIO, STATOK) * 1000 RETURN END