      SUBROUTINE RDF(H2OZ,IJPR,TAZ)
C
C     EVERY DAY PARAMETERS
C
      INCLUDE 'basp.h'
      INCLUDE 'garr.h'! NC,NY,NBN,KH2O
      INCLUDE 'din.h' ! FI,PA,AM,TR,QR,DUR,DURO,KKAL,NREL,NRM,OPMD,OPMDO
      INCLUDE 'yarr.h'! Y,Y3
      INCLUDE 'hetarr.h' ! AR
      INCLUDE 'wrm.h'    ! OFF-LINE PRODUCTION AND DESTRUCTION
      INCLUDE 'darr.h'   ! Kyy,Kyz,Kzy,Kzz,Vb,Wb

      DIMENSION H2OZ(L),TAZ(L)
      DATA YMIN/1.E-20/,AKBOL/1.3806E-19/,DTR/0.0174533/  !'TGOD/365./' NOT USED GM2/00
      PPA=1./AKBOL
C      TI=ITI
C    GM2/00  IF(TI.LE.TGOD)GOTO87
      IF(TI.EQ.1.) NGOD=NGOD+1   ! GM2/00
C
C     END OF THE YEAR
C      TI=TI-TGOD   !GM2/00
C      NGOD=NGOD+1  !GM2/00

  87  IF(IG.NE.0)THEN
         NGOD_P=NGOD-1
      ELSE
         NGOD_P=0
      ENDIF

      NGOD_C=ITYEAR !+NGOD_P   !ITYEAR substituted to NGOD_B  GM2/00
      NGOD_SADM=NGOD_C-1978
      NGOD_SADP=NGOD_SADM
      ITI=INT(TI+0.001)
C
C        MONTH NUMBER
C
         MON=(ITI-1)/30+1
C
C        PARAMETERS FOR TIME INTERPOLATING
C
         MNM=(ITI+15)/30  ! MNM goes from 0 to 12 changing at mid-month
         MNP=MNM+1        ! MNP goes from 1 to 13     "    "     "
         AAP=REAL(ITI+15-MNM*30)/30. !a sort of monthly fraction
         AAM=1.-AAP
         IF(MNM.LT.1)THEN
            MNM=12
            NGOD_SADM=NGOD_SADM-1
         ENDIF
         IF(MNP.GT.12)THEN
            MNP=1
            NGOD_SADP=NGOD_SADP+1
         ENDIF
         IF(NGOD_C.GE.1995)THEN
            IF(NGOD_C.GT.1995)NGOD_SADM=17
            NGOD_SADP=17
         ENDIF
         IF(NGOD_C.LE.1979)THEN
            IF(NGOD_C.LT.1979)NGOD_SADP=1
            NGOD_SADM=1
         ENDIF
!         KKK=INT((FI+88)/4)+1
Cgal         print *,' mon=',mon,' FI=',FI,' KKK=',KKK
c         pause
         DO 1 i=1,L
C
C           TEMPERATURE INTERPOLATION + PRESSURE RESETTING
C
C            TR(i)=TA(i,MNM)*AAM+TA(i,MNP)*AA
            TR(I)=TAZ(I)
c         TR(I)=TA(I,KKK,MON)
C          print *,zkm(i),tr(i)
   1     CONTINUE
C
C        TROPOPAUSE HEIGHT   (CORRECTION 05/08/98)
C
!         IALT_TR=17.*COS(0.75*FI*DTR)    !INT_TR(TR(1,K),L,ZKM)
C
         DO 4 I=1,L
C
C           SULFATE AEROSOL SURFACE AREA
C
C            AR(I)=SAD(I,MNM)*AAM+SAD(I,MNP)*AAP      !SPS 12/15
C            AR(I)=SAD(I,KKK,MON)*1.E-8                        ! /03/26/2005/
C            AR(I)=(SAD(I,MNM,NGOD_SADM)*AAM+
C     *      SAD(I,MNP,NGOD_SADP)*AAP)*1.E-8
C            AR(I)=SAD(I,MNM)*AAM+SAD(I,MNP)*AAP
C            AR(I)=SAD(I,1)
C            IZB=16
C            IF(ZKM(I).GT.ZKM(IZB))
C     *      AR(I)=AR(IZB)*EXP(-(ZKM(I)-ZKM(IZB))/7.)

C
C              AIR NUMBER DENSITY CALCULATION
C
            AM(I)=PA(I)/TR(I)*PPA
C
C           H2O INTERPOLATION FOR TROPOSPHERE
C
C            IF(IJPR.EQ.1.OR.I.LE.IALT_TR)THEN
               Y(KH2O,I)=H2OZ(I)
C
C              H2O FROM PPM TO NUMBER DENSITY
C
               APPM=1.
               IF(Y(KH2O,I).GE.0.5)APPM=1.E-6
               Y(KH2O,I)=Y(KH2O,I)*AM(I)*APPM
C            ENDIF
C
C           RECALCULATION OF CONCENTRATIONS WITH NEW AM
C
            IF(IJPR.NE.1)THEN
               DO 445 J=1,NY
 445              Y(J,I)=Y(J,I)/Y(NC,I)*AM(I)
            ENDIF
            Y(NC,I)=AM(I)
C
C           O2 NUMBER DENSITY
C
            Y(NC-1,I)=AM(I)*0.209476
C
C           N2 NUMBER DENSITY
C
            Y(NC-2,I)=AM(I)*0.78
C            WRITE(*,'(2F6.1,5(1PE10.2))')ZKM(I),TR(I),AM(I),AR(I),
C     $      Y(KH2O,I),Y(KO3,I)
            DO 4 J=1,NY
               IF(Y(J,I).LT.YMIN)Y(J,I)=YMIN
   4     CONTINUE
Cgal   6  WRITE(*,'(A8,F6.1,2(A8,I4))')' Latitude ',FI,' MONTH ',mon,
Cgal     * ' DAY ',ITI
      RETURN
      END

      FUNCTION INT_TR(TR,L,Z)
      DIMENSION TR(L),Z(L)
      IMIN=1
   1  DO WHILE(TR(IMIN+1).LE.TR(IMIN))
         IF(Z(IMIN).GE.25.)GOTO2
         IMIN=IMIN+1
      ENDDO
      IF(Z(IMIN).LT.6.)THEN
        IMIN=IMIN+1
        GOTO1
      ENDIF
   2  INT_TR=IMIN
      RETURN
      END
