      SUBROUTINE HELIOS(JD, CARR, B0, L0, P, DIAM, DIST)
C
C     GIVEN A DATE, THIS ROUTINE RETURNS SIX QUANTITIES USEFUL IN
C     PHYSICAL OBSERVATIONS OF THE SUN:  THE CARRINGTON ROTATION
C     NUMBER, THE APPARENT HELIOGRAPHIC LATITUDE AND LONGITUDE OF
C     THE CENTER OF THE SOLAR DISK, THE APPARENT POSITION ANGLE OF
C     THE SUN'S AXIS OF ROTATION, THE DIAMETER OF THE SOLAR DISK,
C     AND THE DISTANCE FROM THE EARTH TO THE SUN.
C
C
C     B. KNAPP, 1996-01-24, 1999-06-25, 2001-04-24 (i*4)
C
C
C     REFERENCES:
C
C        JEAN MEEUS, ASTRONOMICAL ALGORITHMS 2ND ED, WILLMANN-BELL,
C        1998
C
C
C     INPUT:
C
C        JD     - REAL*8 SCALAR GIVING THE JULIAN DAY NUMBER AND
C                 FRACTION (UT).
C
C
C     OUTPUT:
C
C        CARR   - REAL*8 VARIABLE HOLDING THE CARRINGTON ROTATION
C                 NUMBER (AND FRACTION)
C
C        B0     - REAL*8 VARIABLE HOLDING THE APPARENT HELIOGRAPHIC
C                 LATITUDE OF THE CENTER OF THE SOLAR DISK (DEGREES)
C
C        L0     - REAL*8 VARIABLE HOLDING THE APPARENT HELIOGRAPHIC
C                 LONGITUDE OF THE CENTER OF THE SOLAR DISK (DEGREES)
C
C        P      - REAL*8 VARIABLE HOLDING THE APARENT POSITION ANGLE
C                 OF THE SUN'S AXIS OF ROTATION (DEGREES)
C
C        DIAM   - REAL*8 VARIABLE HOLDING THE DIAMETER OF THE SUN'S
C                 DISK (ARC SECONDS)
C
C        DIST   - REAL*8 VARIABLE HOLDING THE DISTANCE FROM THE EARTH
C                 TO THE SUN (A.U.)
C
C
C     SUBROUTINES USED:
C
C        UT2TD  - CONVERT JULIAN DAY NUMBER, UNIVERSAL TIME, TO
C                 DYNAMICAL (EPHEMERIS) TIME.
C
C        EPHEM  - TO OBTAIN SUN'S APPARENT GEOCENTRIC LONGITUDE AND
C                 DISTANCE (INCLUDING ABERRATION AND NUTATION)
C
C        OBLIQ  - OBTAIN MEAN OBLIQUITY OF THE ECLIPTIC
C
C        NUTATE - OBTAIN NUTATION CORRECTIONS TO LONGITUDE, OBLIQUITY
C
C        UT2CARR- OBTAIN CARRINGTON ROTATION NUMBER FROM JD
C
C
C     RCS DATA
C     
C     $Header$
C     
C     $Log$
C
C
      IMPLICIT NONE
C
C     INPUT
      REAL*8 JD
C
C     OUTPUT
      REAL*8 CARR,B0,L0,P,DIAM,DIST
C
C     CONSTANTS
      REAL*8 TWOPI, D2R, I
      PARAMETER (TWOPI=2.0D0*3.14159265358979324D0,D2R=TWOPI/360.0D0)
      PARAMETER (I=7.25*D2R)
      integer*4 SUN, APPARENT, ECLIPTIC, SPHERICAL
      parameter (SUN=0, APPARENT=2, ECLIPTIC=2, SPHERICAL=1)
C
C     LOCAL
      REAL*8 JDE, T, PV(6), LAMBDA, DPSI, DEPS,
     &   DDPSI, DDEPS, EPS, LAMBDP, THETA, K, SLK, CLK
      INTEGER*4 IERR
C
C     FUNCTIONS, SUBROUTINES
      REAL*8 UT2TD, OBLIQ, UT2CARR
      EXTERNAL UT2TD, EPHEM, NUTATE, OBLIQ, UT2CARR
C
C
C     GET DYNAMICAL (EPHEMERIS) TIME JDE...
      JDE = UT2TD(JD)
C
C     ...AND T, IN JULIAN MILLENIA SINCE J2000
      T = (JDE-2451545.D0)/365250.D0
C
C     GET APPARENT ECLIPTIC LONGITUDE
      CALL EPHEM(JD, SUN, APPARENT, ECLIPTIC, SPHERICAL, PV, IERR)
C
      LAMBDP = PV(1)*D2R
C
C     GET OBLIQUITY OF THE ECLIPTIC
      EPS = OBLIQ( T )
      
C     REMOVE NUTATION CORRECTION FROM LAMBDA AND APPLY TO EPS
      CALL NUTATE( T, DPSI, DEPS, DDPSI, DDEPS )
      LAMBDA = LAMBDP-DPSI
      EPS = EPS+DEPS
C
C     DISTANCE AND DIAMETER
      DIST = PV(3)
      DIAM = 1919.26D0/DIST
C
C     B0, L0
      THETA = ((JDE-2398220.0D0)/25.38D0)*360.D0*D2R
      K = (73.6667D0+1.3958333D0*(JDE-2396758.0D0)/36525.0D0)*D2R
      SLK = SIN(LAMBDA-K)
      CLK = COS(LAMBDA-K)
      B0 = ASIN(SLK*SIN(I))/D2R
      L0 = MOD(ATAN2(-SLK*COS(I),-CLK)-THETA,TWOPI)/D2R
      IF (L0 .LT. 0.D0) L0=L0+360.0D0
C
C     P
      P = (ATAN(-COS(LAMBDP)*TAN(EPS))+ATAN(-CLK*TAN(I)))/D2R
C
C     CARRINGTON ROTATION NUMBER
      CARR = UT2CARR(JD)
C
      RETURN
      END
