      SUBROUTINE SDET4 (MNTH, DAY)
C
C     * JUN 13/06 - M.LAZARE. NEW VERSION FOR GCM15F:
C     *                       COSSD,SINSD,RRSQ NOW REAL*8 AND ALL
C     *                       (NOT JUST ECC) IN COMMON BLOCK, IE
C     *                       COSSD AND SINSD NOT PASSED BACK OUT.
C     * SEP 30/97 - M.LAZARE. PREVIOUS VERSION SDET3.
C     *                       ECCENTRICITY, OBLIQUITY AND PROCESSION
C     *                       PERIOD VALUES MODIFIED SLIGHTLY TO
C     *                       MATCH AMIP2 STANDARDS.      
C     * OCT 28/93 - B.DENIS. PREVIOUS VERSION SDET2 FOR GCM11.
C     * APR 10/81 - J.D.HENDERSON. ORIGINAL VERSION SDET.
C
C     THIS ROUTINE CALCULATES FOR A GIVEN DAY THE SOLAR DECLINATION 
C     AND A RATIO FACTOR THAT MODULATES THE SOLAR CONSTANT. IT ALSO
C     CALCULATES THE MONTH OF WHICH THE DAY BELONG.
C     -----------------------------------------------------------------
C
C                       D  I  C  T  I  O  N  A  R  Y
C 
C       COSSD --> COSINE OF SOLAR DECLINATION.
C       DAY ----> VALUE OF (REAL) IDAY PASSED FROM MAIN.
C       DAYPYR -> DAYS IN YEAR.
C       DEG2RAD-> CONVERSION FACTOR FROM DEGREES TO RADIANS.
C       DEC ----> SOLAR DECLINATION.
C       DY -----> DAY COUNTER.
C       ECC ----> ECCENTRICITY OF EARTH'S ORBIT.
C       EQNX ---> VERNAL EQUINOX, 21 MARCH AT NOON (=80.5)
C       JDY ----> INTEGER VALUE OF JULIAN DAY.
C       JDYACC -> VARIABLE FOR DAY OF MONTH DETERMINATION.
C       JYR ----> INTEGER VALUE OF YEAR.
C       LVAL ---> MONTH INDEX.
C       MAXDAY -> MAXIMUM ALLOWED DAY IN YEAR.
C       MNTH ---> MONTH OF THE YEAR FOR GIVEN DAY(JAN=1,FEB=2..,DEC=12)
C       MNTHDY -> IDENTIFICATION FOR DAY OF MONTH.
C       MONTH --> DAYS IN EACH MONTH, BEGINNING WITH JANUARY.
C       OBQ ----> OBLIQUITY FACTOR IN DEGRES.
C       OBQR ---> OBLIQUITY FACTOR IN RADIANS.
C       OMEGA --> PRECESSION FACTOR IN DEGRES (=ANGLE BETWEEN EQUINOX 
C                 AND PERIHELION MESURED CONTERCLOCKWISE).
C       OMEGAR -> PRECESSION FACTOR IN RADIANS.
C       RRSQ ---> RATIO OF SQUARE MEAN ANNUAL VALUE ORBITAL RADIUS 
C                 (DUE ECCENTRICC ORBIT) TO THE CURRENT VALUE. 
C                 PASSED THROUGH COMMON BLOCK TO SHORTWAVE RADIATION.
C       SINSD --> SINE OF SOLAR DECLINATION.
C       TANOMAL-> TRUE ANOMALY (REAL ANGLE BETWEEN PERIHELION AND 
C                 THE CURRENT POSITION OF THE EARTH ON ITS ORBIT.
C       TLAMBDA-> TRUE LONGITUDE( REAL ANGLE BETWEEN VERNAL EQUINOX
C                 AND THE CURRENT POSITION OF THE EARTH ON ITS ORBIT.
C     -----------------------------------------------------------------

      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)

      INTEGER MONTH(12)
C     
C     * COMMON BLOCK TO PASS INFORMATION OF EARTH'S ECCENTRIC ORBIT
C     * TO PHYSICS AND RADIATION.
C
      REAL           RRSQ,COSSD,SINSD     
      COMMON /ECCENT/RRSQ,COSSD,SINSD
C                                                        
      DATA MONTH/31,28,31,30,31,30,31,31,30,31,30,31/
      DATA PI/3.1415926535898/
C
C     * ASTRONOMICAL PARAMETERS (1950 AD VALUES) (ANGLES ARE IN DEGREES).
C
      DATA DAYPYR/365./
      DATA EQNX/80.5/
      DATA ECC/.016715/
      DATA OMEGA/282.7/  
      DATA OBQ/23.441/     
C     -----------------------------------------------------------------
      DEG2RAD=PI/180.
      OBQR=OBQ*DEG2RAD
      OMEGAR=OMEGA*DEG2RAD
C
C     * ALL ANGLES ARE IN RADIANS BEYOND HERE.
C
      MAXDAY=DAYPYR + 1.0E-2
      JDY=DAY+1.0E-2
      JYR=JDY/MAXDAY
      JDY=JDY-JYR*MAXDAY
C
C     * TO KEEP ALL DAYS WHICH ARE MULTIPLE OF 365 IN DECEMBER
C
      IF (JDY.EQ.0) JDY=365
C
      JDYACC=0    
      DO 251 L=1,12
         LVAL=L
         JDYACC=JDYACC+MONTH(L)
         IF(JDY.LE.JDYACC) GO TO 241
 251  CONTINUE
 241  MNTH=LVAL 
C     
C     * GET THE TRUE ANOMALY(TANOMAL) AND THE TRUE LONGITUDE (TLAMBDA).
C
      CALL ANGLES(TANOMAL,TLAMBDA, DAYPYR,EQNX,ECC,OMEGAR,DAY)
C     
C     * DETERMINE FACTOR TO SCALE MEAN SOLAR CONSTANT BY IN SHORTWAVE
C     * RADIATION, TO ACCOUNT FOR EARTH'S ECCENTRICITY (PASSED THROUGH
C     * COMMON BLOCK "ECCENT").
C     
      RRSQ=((1.+ECC*COS(TANOMAL))**2)/((1.-ECC**2)**(3./2.))
C
C     * DETERMINE DECLINATION.
C
      SINSD=SIN(TLAMBDA)*SIN(OBQR)
      DEC=ASIN(SINSD)
      COSSD=COS(DEC)
C
      RETURN
      END
