     
      SUBROUTINE INPUT_INTERP(temp_alt, water, O3, Jcold, T, FI)
C-KK This subroutine interpolates the (alt),water, ozone file that is READ in 
C-KK from atm_chem.

      INCLUDE '../header.inc'
      PARAMETER (NZ=100)
      DIMENSION O3(NZ), water(NZ), temp_alt(NZ),T(ND),FI(4,ND)
      CHARACTER :: DIRINOUT*2,DIRDATA*4
      COMMON/DIR/DIRINOUT,DIRDATA
      COMMON/ALTBLOK/DALT(ND-1),RADIUS(ND-1),PARTICLES(ND),RAER(ND),
     & 		     ALT(ND)
      COMMON/PRESSURE/P(ND),PLOG(ND)

C-KK   both indices starting at ground level
	istart = 1
	j = ND
	FI(4,j) = O3(istart)

	istart = istart+1
	top = temp_alt(NZ)
	
	DO j = ND-1, 1, -1
	 DO i = istart, NZ
	   IS = i
	   if (temp_alt(i) .GT. ALT(j)) GOTO 350
	 END DO
  350  CONTINUE
	 IS1 = IS-1
 	 istart = IS1
	 IF (IS .GT. NZ) GOTO 471
	 DZI = temp_alt(IS)-temp_alt(IS1)
	 DZJ = ALT(j) - temp_alt(IS1)
	 FR = DZJ/DZI
	 IF (ALT(j) .LT. top) THEN
 	   O3log1 = ALOG(O3(IS1))
	   O3log2 = ALOG(O3(IS))
	   O3log = (FR*O3log2) + ((1-FR)*O3log1)	
	  ELSE O3log = FI(4,j+1)
	 END IF	
	 FI(4,j) = EXP(O3log)
 	 Flog1 = ALOG(water(IS1))
	 Flog2 = ALOG(water(IS))
	 flog = (FR*Flog2) + ((1-FR)*Flog1)
	 FI(1,j) = EXP(flog)
	END DO
  471  CONTINUE

	DO k =1, ND
	  if (ALT(k) .GE. temp_alt(JCOLD)) jcold_new = k
 	END DO
	
	JCOLD = jcold_new

	RETURN
        END
