The following program prompts for the name of an ASCII housekeeping file, whether the conversion is to be (RA,DEC) to (X,Y) or vice-versa, and a pair of coordinate values. It reports the transformed coordinates.
PROGRAM SCOSPOS *+ * Name: * SCOSPOS * Purpose: * Convert positions to celestial coordinates or vice versa. * Language: * Fortran 77. * Type of Module: * Main program * Arguments: * STATUS = INTEGER (Given and Returned) * The global status. * Description: * Convert plate positions measured by SuperCOSMOS to celestial * coordinates or vice versa. * * The celestial coordinates are returned or input in the mean * desired system specified in the ACII summary housekeeping file. * * This program is intended as an example/template to demonstrate how * to use the standalone version of the SuperCOSMOS coordinate * conversion software. * Prior Requirements: * A SuperCOSMOS ASCII summary housekeeping file with the appropriate * transformation coefficients must already exist. * Algorithm: * Obtain the name of the housekeeping file. * Extract the transformation coefficients etc. from the housekeeping * file. * If ok then * Determine whether converting plate positions to celestial * coordinates or vice versa. * if converting plate positions to celestial coordinates then * Obtain the plate positions. * Convert the positions to celestial coordinates. * Report the celestial coordinates. * else converting celestial coordinate to plate positions * Obtain the celestial coordinates. * Convert the celestial coordinates to plate positions. * Report the plate positions. * end if * end if * Report any error. * Authors: * ACD: A C Davenhall (Leicester) * History: * 18/5/95 (ACD): Original version. * 19/5/95 (ACD): First stable version. * 17/8/95 (BDK): move the subroutines into the cpc library * 31/7/96 (BDK): SCOSPOS derived from POSTRAN program * Bugs: * None known. *- * Type Definitions: IMPLICIT NONE ! No implicit typing * Global Constants: INCLUDE 'SAE_PAR' ! Standard SAE constants * Global Variables: * <...> * Status: INTEGER STATUS ! Global status * External References: * <...> * Local Constants: * <...> * Local Variables: CHARACTER : HSEKP*75, ! Name of the housekeeping file. : CONVRT*1, ! Flag: convert x,y --> alpha,delta or vice versa. : RASGF*15, ! Right Ascension in sexagesimal hours. : DCSGF*15, ! Declination in sexagesimal degrees. : RARAD*20, ! Right Ascension in radians. : DCRAD*20 ! Declination in radians. DOUBLE PRECISION : X, ! X position (0.01 micron). : Y, ! Y " ( " " ). : ALPHA, ! Right Ascension (radians). : DELTA ! Declinatioin ( " ). INTEGER : HKLUN, ! logical unit number : IX, ! INTEGER X position (0.01 micron). : IY, ! " Y " ( " " ). : ISTAT ! Internal Fortran I/O status (ignored). CHARACTER*12 DTSYS__TRAN ! Desired time system. CHARACTER*12 PTSYS__TRAN ! Plate time system. DOUBLE PRECISION DEQIN__TRAN ! Desired equinox. DOUBLE PRECISION PEPCH__TRAN ! Plate epoch. DOUBLE PRECISION BAKCF__TC(6) ! Transform coefficients: x,y to RA,dec. DOUBLE PRECISION PLTCF__TC(6) ! Transform coefficients: RA,dec to x,y. DOUBLE PRECISION DISTR__TC ! Distortion coefficient. DOUBLE PRECISION RACEN__TC ! Right Ascension of the plate centre ! (radians). DOUBLE PRECISION DECEN__TC ! Declination of the plate centre ! (radians). DOUBLE PRECISION PRMS__MO(35) ! array for converting mean to observed ! coordinates *. STATUS = SAI__OK * * Obtain the name of the ASCII housekeeping file. PRINT *, 'Give name of ASCII housekeeping file' READ ( 5, '(A)' ) HSEKP * * Extract the transformation coefficients etc. from the housekeeping * file. HKLUN = 1 CALL SCOSPOS_READHK ( HSEKP, HKLUN, DTSYS__TRAN, PTSYS__TRAN, : DEQIN__TRAN, PEPCH__TRAN, BAKCF__TC, PLTCF__TC, DISTR__TC, : RACEN__TC, DECEN__TC, PRMS__MO, STATUS ) IF (STATUS .EQ. SAI__OK) THEN * * Determine whether converting plate positions to celestial * coordinates or vice versa. PRINT *, : 'Converting to celestial (C) or plate (P) coordinates?' READ ( 5, '(A)' ) CONVRT * * Proceed with whichever conversion is appropriate. IF ( ( CONVRT .EQ. 'C' ) .OR. ( CONVRT .EQ. 'c' ) ) THEN * * Converting x,y positions to celestial coordinates. PRINT *, 'Give X in 0.01 micron' READ ( 5, * ) X PRINT *, 'Give Y in 0.01 micron' READ ( 5, * ) Y CALL SCOSPOS_XYTOAD ( X, Y, DTSYS__TRAN, PTSYS__TRAN, : DEQIN__TRAN, PEPCH__TRAN, BAKCF__TC, DISTR__TC, : RACEN__TC, DECEN__TC, PRMS__MO, ALPHA, DELTA, STATUS ) * * Display the coordinates. CALL SCOSPOS_R2SGF (ALPHA, 'HOURS', 2, RASGF, STATUS) CALL SCOSPOS_R2SGF (DELTA, 'DEGREES', 1, DCSGF, STATUS) PRINT *, 'Corresponding coordinates:' PRINT *, 'Right Ascension = ', RASGF, ' hours' PRINT *, 'Declination = ', DCSGF, 'degrees' WRITE (RARAD, '(1PD20.10)', IOSTAT=ISTAT) ALPHA WRITE (DCRAD, '(1PD20.10)', IOSTAT=ISTAT) DELTA PRINT *, '(or Right Ascension = ', RARAD PRINT *, 'Declination = ', DCRAD PRINT *, 'in radians).' ELSE * * Converting celestial coordinates to x,y positions. PRINT *, 'Give ALPHA in radians' READ ( 5, * ) ALPHA PRINT *, 'Give DELTA in radians' READ ( 5, * ) DELTA CALL SCOSPOS_ADTOXY ( ALPHA, DELTA, DTSYS__TRAN, : PTSYS__TRAN, DEQIN__TRAN, PEPCH__TRAN, PRMS__MO, : DISTR__TC, RACEN__TC, DECEN__TC, PLTCF__TC, X, Y, STATUS ) * * Display the positions. IX = NINT(X) IY = NINT(Y) PRINT *, 'Corresponding SuperCOSMOS positions:' PRINT *, 'X = ', IX PRINT *, 'Y = ', IY PRINT *, '(both in 0.01 micron).' END IF END IF END