c $Header: /usr/people/flittner/radtran/tomrad/pv2.2/src/RCS/get_coef.f,v 2.22 2000/08/30 16:38:09 flittner Exp $ logical function get_coef(start, ending, lambda, c0, c1, c2, beta, * rhon) C======================================================================C C C C FUNCTION : GET_COEF C C C C PURPOSE: This subroutine reads the ozone absorption and C C Rayleigh scattering coefficients and splines the C C to the correct wavelenght C C C C USE: C C call get_coef(lambda, c0, c1, c2, beta) C C C C PARAMETERS : C C C C Lambda - Real*4 input parameter. The wavelength in C C angstroms. C C c0, c1, c2 - Real*4 output. Ozone absoption coef. C C Alpha = c0 + c1 * T + c2 * T**2, where C C T is the temperature in Celsius. C C beta - Real*4 Output. Rayleigh coefficient at that C C wavelength. C C C C SOURCE: DONALD J. RICHARDSON C C HUGHES STX C C C C LANGUAGE: FORTRAN 77 C C C C DATE STARTED : September 28, 1994 C C C C LATEST REVISION: September 28, 1994 C c c last mod. Sep. 2, 1998...def c purpose: pass data file name in common block cfilenames and c change the name of the variable to coeffn. C C C C C======================================================================C implicit none include 'cfilenames.cmn' ! ! Calling Parameters ! real*8 start ! Input -- Starting wavelength real*8 ending ! Input -- ending wavelength real*8 lambda ! Output -- Wavelength real*8 c0 ! Output -- Ozone absorption coef (const term) real*8 c1 ! Output -- Ozone Absorption coef (T(c deg) term) real*8 c2 ! Output -- Ozone Absorption coef (T(c deg)^2 term) real*8 beta ! Output -- Rayleigh scattering coef real*8 rhon ! Output -- depolarization factor ! ! Local Variables ! logical first_time integer*4 iunit character*80 junk data first_time/.true./ save first_time,iunit,junk ! ! If this is the first time read the data file and initialize spline. ! if (first_time) then ! ! Get a free logical unit number ! call get_lun(iunit) ! ! Check to see if all LUN are in use ! if (iunit .lt. 0) then write(*, * '(''No Logical Units available to be open in get_coef'')') stop 'No LUN avaiable' end if ! ! Open coefficient data file first_time = .false. open (iunit, file=coeffn, status = 'old', err = 200) read(iunit,'(a)') junk ! Header line ! ! locate the first data set ! 90 read(iunit,*,end=100) lambda, c0, c1, c2, beta, rhon if (lambda .lt. start) go to 90 get_coef = lambda .le. ending return end if ! ! Getting next data set ! read (iunit,*,end = 100) lambda, c0, c1, c2, beta, rhon get_coef = lambda .le. ending return ! ! End of file reached.... No more data ! 100 get_coef = .false. return 200 print*, 'Error in opening the coefficient database:', * coeffn stop 'Error in opening coefficient database' end