SUBROUTINE VGTFIT ( * * inputs * : INTBL, * * output * : TSTART, TEND, A, P, STATUS) * * Module Number: * * Module Name: * * Keyphrase: * ---------- * Read the ephemeris fitting coefficients * * Description: * ------------ * Get the fitting coefficients of the space craft ephemeris, and the starting * and ending epoches of the fit * * FORTRAN Name: VGTFIT.FOR * * Keywords of Accessed Files and Tables: * -------------------------------------- * Name I/O Description / Comments * * column names of the input table: * * 'FIT_START' I beginning epoch of the fitting * 'FIT_END' I ending epoch of the fitting * 'G1', 'G2', 'G3' I ephemeris fitting coefficients * 'F1_1', 'F1_2', ..., 'F1_7' I ephemeris fitting coefficients * 'F2_1', 'F2_2', ..., 'F2_7' I ephemeris fitting coefficients * 'F3_1', 'F3_2', ..., 'F3_7' I ephemeris fitting coefficients * 'F4_1', 'F4_2', ..., 'F4_7' I ephemeris fitting coefficients * * Subroutines Called: * ------------------- * CDBS: * CDTIN * SDAS: * UTRGTD, UTRGTI, UTTCLO, UMSPUT * OTHERS: * None * * History: * -------- * Version Date Author Description * 1 06-11-89 J.-C. Hsu Design and coding * *------------------------------------------------------------------------------- * *== input: * --input table name CHARACTER*(*) INTBL * *== output: * --start and end time of the fit INTEGER TSTART, TEND, * --error status : STATUS * --ephemeris coefficients DOUBLE PRECISION A(1), P(4,7) * *== local: * CHARACTER*1 SUB1, SUB2 CHARACTER*5 CHAR5 * --column names of input table CHARACTER*16 COLNAM(50) * --error message context CHARACTER*130 CONTXT, MESS * --number of columns INTEGER NCOLS, * --number of rows in the input table : NROWS, * --table pointer : TP, * --table column ID : COLIDN(50), * --error status : STAT(50), STATOK, * --loop indices : I, J, K, NC, NG, NF1, NF2 DOUBLE PRECISION BUFF(50) LOGICAL NULMSK(50) *=========================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=========================================== *------------------------------------------------------------------------------- * * column names of ephemeris fitting coefficients * COLNAM(1) = 'FIT_START' COLNAM(2) = 'FIT_END' NC = 2 NG = 3 NF1 = 4 NF2 = 7 * DO 10 I = 1, NG WRITE(SUB1, '(I1)') I COLNAM(NC+I) = 'G' // SUB1 10 CONTINUE * DO 30 I = 1, NF1 WRITE(SUB1, '(I1)') I DO 20 K = 1, NF2 WRITE(SUB2, '(I1)') K COLNAM(NC+NG+(I-1)*NF2+K) = 'F' // SUB1 // '_' // SUB2 20 CONTINUE 30 CONTINUE * NCOLS = NC + NG + (NF1 * NF2) * * set up input table * CALL CDTIN (INTBL, COLNAM, NCOLS, TP, COLIDN, NROWS, STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot set up table ' // INTBL GO TO 999 END IF * * warning if there is no data * IF (NROWS .LT. 1) THEN CONTXT = '# of rows is 0 ' // ' in table ' // INTBL STATUS = ERRNUM(1) GO TO 999 END IF * * read the last row of the input table * CALL UTRGTI (TP, COLIDN(1), 1, NROWS, : TSTART, NULMSK(1), STAT(1)) CALL UTRGTI (TP, COLIDN(2), 1, NROWS, : TEND, NULMSK(2), STAT(2)) CALL UTRGTD (TP, COLIDN(NC+1), NG, NROWS, : A, NULMSK(NC+1), STAT(3)) CALL UTRGTD (TP, COLIDN(NC+NG+1), NF1*NF2, NROWS, : BUFF, NULMSK(NC+NG+1), STAT(4)) * * check status * DO 40 J = 1, 4 IF (STAT(J) .NE. OK) THEN WRITE (CHAR5, '(I5)') NROWS STATUS = ERRNUM(1) CONTXT = 'cannot read row ' // CHAR5 // ' of table ' : // INTBL GO TO 999 END IF 40 CONTINUE * * check null mask, if there is a null value, set error flag and exit * DO 50 J = 1, NCOLS IF (NULMSK(J)) THEN STATUS = ERRNUM(1) CONTXT = 'null value encountered in input table' GO TO 999 END IF 50 CONTINUE * * assign coefficients * DO 70 I = 1, NF1 DO 60 K = 1, NF2 P(I, K) = BUFF((I-1)*NF2+K) 60 CONTINUE 70 CONTINUE * * close table * CALL UTTCLO (TP, STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot close table ' // INTBL GO TO 999 END IF * STATUS = OK GO TO 1000 * * write error message * 999 MESS = 'VGTFIT: ' // CONTXT CALL UMSPUT (MESS, DEST, PRIO, STATOK) * 1000 RETURN END