SUBROUTINE VGTCV ( * * inputs * : OBSID, INTBL, DIM, * * output * : DET, GAIN, BASE, COEFF, : TEMP0, EPOCH0, NROWS, STATUS) * * Module Number: * * Module Name: * * Keyphrase: * ---------- * Read the CVC offset calibration coefficient table * * Description: * ------------ * Get the calibration polynomial coefficients, base value, and * zero points of the CVC offset * * FORTRAN Name: VGTCV.FOR * * Keywords of Accessed Files and Tables: * -------------------------------------- * Name I/O Description / Comments * * column names of the input table: * * 'DET_NUM' I detector ID * 'VGAIND' I gain setting * 'A00', 'A01', ..., 'A33' I calibration polynomial coefficients * 'BASE_TIME' I reference epoch * 'BASE_TEMP' I reference temperature * 'BASE_VALUE' I base value of the calibration * * Subroutines Called: * ------------------- * CDBS: * VCDTIN * SDAS: * UTRGTR, UTRGTD, UTRGTT, UTRGTI, UTTCLO, UMSPUT * OTHERS: * None * * History: * -------- * Version Date Author Description * 1 08-01-88 J.-C. Hsu Design and coding * 2 11-15-89 J.-C. Hsu pass OBSID *------------------------------------------------------------------------------- * *== input: * --observation ID CHARACTER*(*) OBSID, * --input table name : INTBL * --maximum number of rows allowed for * --the input table INTEGER DIM * *== output: * --detector ID INTEGER DET(1), * --number of rows in the calibration table : NROWS, * --error status : STATUS * --gain setting REAL GAIN(1), * --base value of the desired quantity : BASE(1), * --polynominal coefficients : COEFF(16,1), * --zero point of temperature : TEMP0(1) * --zero point of epoch DOUBLE PRECISION EPOCH0(1) * *== local: * CHARACTER*1 SUB1, SUB2 CHARACTER*5 CHAR5 * --column names of input table CHARACTER*16 COLNAM(30) * --error message context CHARACTER*130 CONTXT, MESS * --number of columns INTEGER NCOLS, * --table pointer : TP, * --table column ID : COLIDN(30), * --error status : STAT(30), STATOK, * --loop indices : I, J, K LOGICAL NULMSK(30) *=========================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 polynomial coefficients * DO 20 I = 0, 3 WRITE(SUB1, '(I1)') I DO 10 K = 0, 3 WRITE(SUB2, '(I1)') K COLNAM(I*4+K+1) = 'A' // SUB1 // SUB2 10 CONTINUE 20 CONTINUE * * column names of base values * COLNAM(17) = 'BASE_VALUE' COLNAM(18) = 'BASE_TEMP' COLNAM(19) = 'BASE_TIME' * * column names of attributes * COLNAM(20) = 'DET_NUM' COLNAM(21) = 'VGAIND' NCOLS = 21 * * set up input table * CALL VCDTIN (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 or if the number of rows is over the maximum * limit * IF (NROWS .LT. 1 .OR. NROWS .GT. DIM) THEN WRITE (CHAR5, '(I5)') DIM CONTXT = '# of rows is 0 or > ' // CHAR5 // ' in table ' // : INTBL STATUS = ERRNUM(1) GO TO 999 END IF * * read the input table row by row * DO 30 I = 1, NROWS CALL UTRGTR (TP, COLIDN(1), 16, I, : COEFF(1, I), NULMSK(1), STAT(1)) CALL UTRGTR (TP, COLIDN(17), 1, I, : BASE(I), NULMSK(17), STAT(2)) CALL UTRGTR (TP, COLIDN(18), 1, I, : TEMP0(I), NULMSK(18), STAT(3)) CALL UTRGTD (TP, COLIDN(19), 1, I, : EPOCH0(I), NULMSK(19), STAT(4)) CALL UTRGTI (TP, COLIDN(20), 1, I, : DET(I), NULMSK(20), STAT(5)) CALL UTRGTR (TP, COLIDN(21), 1, I, : GAIN(I), NULMSK(21), STAT(6)) * * check status * DO 30 J = 1, 6 IF (STAT(J) .NE. OK) THEN WRITE (CHAR5, '(I5)') I STATUS = ERRNUM(1) CONTXT = 'cannot read row ' // CHAR5 // ' of table ' : // INTBL GO TO 999 END IF 30 CONTINUE * * check null mask, if there is a null value, set base value of that * row to zero and continue * DO 40 J = 1, NCOLS IF (NULMSK(J)) THEN BASE(I) = 0. GO TO 50 END IF 40 CONTINUE 50 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 = OBSID // ' VGTCV: ' // CONTXT CALL UMSPUT (MESS, DEST, PRIO, STATOK) * 1000 RETURN END