      SUBROUTINE DIURN( TJD, GAST, RAA, DCA, RAT, DCT )
C
C           Calculates diurnal abberation
C    TJD   Julian date ( in Terestial dynamical time )
C    GAST  Greenwich aparent sideral time
C    RAA   Apparent geocentric right ascen.
C    DCA   Apparent geocentric decl.
C    RAT   Topocentric right ascen. ( output )
C    DCT   Topocentric decl. ( output )
C
      IMPLICIT UNDEFINED(A-Z)
      SAVE
      REAL *8 PI, TWOPI, RADCON, C, ERAD, AU, VROT, DLAT, DLON, HT
      REAL *8 SINLAT, COSLAT, RHO, ROTVEL, ABRCON
      REAL *8 TJD, RAA, DCA, RAT, DCT, GAST, HA
      REAL *8 SINHA, COSHA, SINDEC, COSDEC, ALT, SINALT
      PARAMETER ( PI = 3.141592653589793D0 )
      PARAMETER ( TWOPI = 2.D0*PI )
      PARAMETER ( RADCON = PI / 180.D0 )
      PARAMETER ( C = 2.99792538D8 )
      PARAMETER ( ERAD = 6378140.D0 )
      PARAMETER ( AU = 1.49597870D11 )
      PARAMETER ( VROT = 7.2921151467D-5 )
C           Mt Wilson geocentric coordinates.
      PARAMETER ( DLAT =  34.2166944D0 )
      PARAMETER ( DLON = 118.0591670D0 )
      PARAMETER ( HT   = 1742.0D0 )
      LOGICAL FIRST
      DATA FIRST / .TRUE. /
C
      IF ( FIRST ) THEN 
          FIRST  = .FALSE.
          SINLAT = DSIN ( DLAT * RADCON )
          COSLAT = DCOS ( DLAT * RADCON )
          RHO = ( ERAD + HT  - 21400.D0 * SINLAT*SINLAT ) / ERAD
          ROTVEL = VROT * RHO * ERAD
          ABRCON = ROTVEL * COSLAT / C
      END IF
      HA  = ( (GAST - RAA ) * 15.D0 - DLON ) * RADCON
      SINHA  = DSIN( HA )
      COSHA  = DCOS( HA )
      SINDEC = DSIN( DCA * RADCON )
      COSDEC = DCOS( DCA * RADCON )
C
C         Test for object above the hroizon
C
      SINALT = SINLAT * SINDEC + COSLAT * COSDEC * COSHA
      ALT    = DASIN ( SINALT ) / RADCON
      IF ( ALT .LE. -1.D0 ) THEN
          RAT = 99.9D0
          DCT = 99.9D0
      ELSE
C           Apply correction for dirunal abberation
          RAT = RAA + ( ABRCON * COSHA / COSDEC ) /(15.D0*RADCON)
          DCT = DCA + ( ABRCON * SINHA * SINDEC ) / RADCON 
      END IF
      RETURN
      END
