      SUBROUTINE ANGLES(TANOMAL,TLAMBDA, DAYPYR,EQNX,ECC,OMEGA,DAY)
C     
C     * NOV 02/93 - B.DENIS. ORIGINAL VERSION.
C
C     THIS ROUTINE CALCULATES FOR A GIVEN DAY AND FOR GIVEN ORBITAL 
C     PARAMETERS THE TRUE ANOMALY AND THE TRUE LONGITUDE.
C
C     -THE TRUE ANOMALY IS DEFINED AS THE ANGLE MESURED CONTERCLOCK
C      WISE FROM THE PERIHELION TO THE CURRENT EARTH'S POSITION ALONG 
C      ITS ORBIT. 
C     -THE TRUE LONGITUDE IS DEFINED AS THE ANGLE MESURED CONTERCLOCK 
C      WISE FROM THE VERNAL EQUINOX TO THE CURRENT EARTH'S POSITION 
C      ALONG ITS ORBIT.
C
C     NOTES: -APROXIMATIONS USED HERE WHICH SOLVE THE KEPLER'S EQUATION
C             ARE FROM BERGER 1993. THEY ONLY ARE GOOD FOR ECCENTRICITY
C             SMALLER THAN 0.1 .
C            -ORBITAL'S PARAMETERS ARE SETTED BY SUBROUTINE SDET2.
C            -ALL ANGLES ARE IN RADIANS AND MESURED CONTERCLOCK WISE.
C             MOST OF ALL CAN BECOME GREATER THAN 2 PI RADIANS AS 
C             "DAY" INCREASES (THEY ARE NOT SETTED TO ZERO AFTER EACH
C             COMPLETE REVOLUTION.

C     ----------------------------------------------------------------
C     D  I  C  T  I  O  N  A  R  Y
C
C       DAY ----> VALUE OF (REAL).
C       DAYPYR -> DAYS IN YEAR.
C       ECC ----> ECCENTRICITY OF EARTH'S ORBIT.
C       EQNX ---> VERNAL EQUINOX, 21 MARCH AT NOON (=80.5).
C       OMEGA --> PRECESSION FACTOR (ANGLE MESURED FROM VERNAL EQUINOX
C                 TO PERIHELION).
C       MANOMAL-> MEAN ANOMALY (ANGLE MESURED FROM PERIHELION TO A 
C                 IMAGINATED POSITION OF THE EARTH IF THE ANGULAR SPEED
C                 WAS CONSTANT).
C       TANOMAL-> TRUE ANOMALY (ANGLE MESURED FROM PERIHELION TO THE
C                 THE CURRENT POSITION OF THE EARTH).
C       ITANOM -> TRUE ANOMALY OF THE VERNAL EQUINOX POSITION.
C                 (ANGLE MESURED FROM PERIHELION TO THE VERNAL
C                 EQUINOX POSITION).
C       MLAMBDA-> MEAN LONGITUDE. (AS MANOMAL BUT MESURED FROM THE
C                 VERNAL EQUINOX)
C       TLAMBDA-> TRUE LONGITUDE (ANGLE MESURED WISE FROM THE VERNAL
C                 EQUINOX TO THE CURRENT POSITION OF THE EARTH).
C       IMLAMB -> MEAN ANOMALY OF THE VERNAL EQUINOX MESURED
C                 FROM THE VERNAL EQUINOX POSITION. THIS ANGLE IS A
C                 CONSTANT FOR ANY DAY OF THE YEAR BECAUSE IT DEPENDS 
C                 ONLY ON THE PRECESSION. 
C     ----------------------------------------------------------------
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      REAL BETA,CFI
      REAL DAYPYR,EQNX,ECC,OMEGA,DAY
      REAL IMLAMB,MLAMBDA,TLAMBDA
      REAL TANOMAL,MANOMAL,ITANOM

C     
      DATA PI/3.1415926535898E0/
C
C     * DETERMINE THE TRUE ANOMALY FOR THE VERNAL EQUINOX.
C
      ITANOM=(2.E0*PI-OMEGA)
C
      IF (ECC.EQ.0.E0) THEN
C
C       * DO TRIVIAL CALCULATION FOR THE NULL ECCENTRICITY CASE.
C
        TLAMBDA =(DAY-EQNX)*(2*PI/DAYPYR)
        TANOMAL=TLAMBDA + ITANOM
C
      ELSE
C
C       * FOR CASES OF NON NULL ECCENTRICITY.
C       * 1-DETERMINE THE MEAN LONGITUDE.
C
        CFI=SQRT(1.E0-ECC**2)
        BETA=(1.0E0-CFI)/ECC
        IMLAMB=2.E0*( BETA*(1.E0+CFI)*SIN(ITANOM)
     1         -(BETA**2)*(0.5E0+CFI)*SIN(2.E0*ITANOM)
     2         +(BETA**3)*(1.E0/3.E0+CFI)*SIN(3.E0*ITANOM) )  
        MLAMBDA=(DAY-EQNX)*(2.E0*PI/DAYPYR) - IMLAMB
C
C       * 2-DETERMINE THE MEAN ANOMALY.
C
        MANOMAL=ITANOM + MLAMBDA
C
C       * 3-DETERMINE THE TRUE LONGITUDE. PASSED BACK TO SDET3
C       *   FOR THE DECLINATION'S CALCULATION.
C
        TLAMBDA=MLAMBDA + (2.E0*ECC
     1         -(ECC**3)/4.E0+(ECC**5)*5.E0/96.E0+(ECC**7)*107.E0/
     2         4608.E0)*SIN(MANOMAL)
     3         +((ECC**2)*5.E0/4.E0+(ECC**4)*11.E0/24.E0+
     4         (ECC**6)*17.E0/192.E0)*SIN(2.E0*MANOMAL)
     5         +((ECC**3)*13.E0/12.E0+(ECC**5)*43.E0/64.E0+
     6         (ECC**6)*95.E0/512.E0)*SIN(3.E0*MANOMAL)
C
C       * 4- DETERMINE THE TRUE ANOMALY. PASSED BACK TO SDET3
C       *    FOR THE RRQS RATIO'S CALCULATION.
C
        TANOMAL=ITANOM + TLAMBDA
C     
      ENDIF

      RETURN
      END
