SUBROUTINE CDPTRG( * * outputs * : TARGET, FILTER, POL, DPOL, THETA, : DTHETA, NPTS, STATUS) * * Module Number: * * Module Name: * * Keyphrase: * ---------- * Read the table containing polarization information of polarized standard * targets. * * Description: * ------------ * Get polarizations and position angles (in equatorial system) of polarized * standard targets. Each standard target can have up to 5 different names. * * FORTRAN Name: CDPTRG.FOR * * Keywords of Accessed Files and Tables: * -------------------------------------- * Name I/O Description / Comments * * keyword input from PAR file: * * 'refpol' I SDAS table containing polarized standard * target data * * Column names in REFPOL: * * 'OBJ_NAME_1', 'OBJ_NAME_2',..., 'OBJ_NAME_5' * I name(s) of the standard target(s) * 'FILTER_NAME' I filter name * 'P' I polarization of the target (in per cent) * 'P_ERR' I error of polarization * 'THETA' I polarization position angle of the * target (equatorial system, in degrees) * 'THETA_ERR' I error of position angle * * Subroutines Called: * ------------------- * CDBS: * CDTIN * SDAS: * UCLGST, UTRGTR, UTRGTI, UTTCLO, UMSPUT * OTHERS: * None * * History: * -------- * Version Date Author Description * 1 07-15-86 J.-C. Hsu Design and coding * 2 10-05-87 J.-C. Hsu F77 standard * 3 12-01-89 J.-C. Hsu error propagation *------------------------------------------------------------------------------- * *== output: * --object names of targets CHARACTER*(*) TARGET(5,*), : FILTER(1) * --polarization and position angle of * --the standard target REAL POL(1), THETA(1), : DPOL(1), DTHETA(1) * --number of entries of input table INTEGER NPTS, * --error status : STATUS * *== local: * --loop index INTEGER I, J, * --number of rows and columns and names : NROWS, NCOLS, NNAMES, * --error status : STAT(10), STATOK, * --table pointer and column ID : TP, COLIDN(10) * --data buffer REAL COLBUF(10) LOGICAL NULMSK(10) CHARACTER*1 CHAR1 CHARACTER*5 CHAR5 * --column names CHARACTER*16 COLNAM(10) * --target names CHARACTER*20 TRGT(5) * --table name CHARACTER*128 TBNAME * --error message context 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=========================================== *------------------------------------------------------------------------------- * * initialization * NPTS = 0 NNAMES = 5 * * set up standard polarization target table * NCOLS = 10 COLNAM(1) = 'FILTER_NAME' COLNAM(2) = 'P' COLNAM(3) = 'P_ERR' COLNAM(4) = 'THETA' COLNAM(5) = 'THETA_ERR' * DO 10 I = 1, NNAMES WRITE (CHAR1, '(I1)') I COLNAM(5+I) = 'OBJ_NAME_' // CHAR1 10 CONTINUE * * read the name of the standard polarization target table * CALL UCLGST ('refpol', TBNAME, STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot get standard polarization target table ' : // 'keyword name' GO TO 999 END IF * * set up standard polarization target table * CALL CDTIN (TBNAME, COLNAM, NCOLS, : TP, COLIDN, NROWS, STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot set up standard polarization target table' GO TO 999 END IF * * read standard polarization target table * DO 50 I = 1, NROWS CALL UTRGTT (TP, COLIDN(1), 1, I, : FILTER(I), NULMSK(1), STAT(1)) CALL UTRGTR (TP, COLIDN(2), 4, I, : COLBUF, NULMSK(2), STAT(2)) CALL UTRGTT (TP, COLIDN(6), 5, I, : TRGT, NULMSK(6), STAT(3)) * STATOK = ABS(STAT(1) - OK) + ABS(STAT(2) - OK) + : ABS(STAT(3) - OK) + OK * * a target should have at least one name * DO 20 J = 1, NCOLS-4 IF (NULMSK(J)) THEN STATOK = ERRNUM(1) GO TO 30 END IF 20 CONTINUE * 30 IF (STATOK .NE. OK) THEN WRITE (CHAR5, '(I5)') I CONTXT = 'cannot read data entry #' // CHAR5 CALL UMSPUT (CONTXT, DEST, PRIO, STATOK) ELSE NPTS = NPTS + 1 FILTER(NPTS) = FILTER(I) POL(NPTS) = COLBUF(1) DPOL(NPTS) = COLBUF(2) THETA(NPTS) = COLBUF(3) DTHETA(NPTS) = COLBUF(4) DO 40 J = 1, NNAMES TARGET(J, NPTS) = TRGT(J) 40 CONTINUE END IF 50 CONTINUE * * close table * CALL UTTCLO (TP, STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot close standard polarization target table' GO TO 999 END IF * STATUS = OK GO TO 1000 * * write error message * 999 MESS = 'CDPTRG: ' // CONTXT CALL UMSPUT (MESS, DEST, PRIO, STATOK) * 1000 RETURN END