c $Header: /usr/people/flittner/radtran/tomrad/pv2.2/src/RCS/readin.f,v 2.22 2000/08/30 16:38:09 flittner Exp $ subroutine readin c author: c. seftor c date: 28-jan-1991 c purpose: reads in all necessary input for the mateer code c last mod. Sep. 2, 1998...def c purpose: use include for all common blocks. Also pass input file name c in common cfilenames. c c last mod. Sep. 6, 1998...def c purpose: combine several commons into switches.cmn. Also, read c lreadmu from the PROF file by checking to see if 'mu' is in the c comment line above the scan angles. c c last mod. Sep. 30, 1998...def c purpose: fill the iter array with max_num_iter. c c last mod. May 6, 1999...def c purpose: check to make input surface pressure <= 1atm. c implicit none include 'parameter.inc' include 'inchr.cmn' include 'input.cmn' include 'log.cmn' include 'contrl.cmn' include 'switches.cmn' include 'depolt.cmn' include 'cfilenames.cmn' c local integer*4 num,naz,i,j,i3,i4 logical lprt character*80 inline character*72 buf logical torf external torf c lprt=.TRUE. c open (unit=22, file=inprffn, status='old') read (22,'(a)') buf prfnam=buf(1:6) if(lprt)write (*, '(''PRFNAM = '',a)') prfnam read (22,*) pres c check to see if pres <= 1atm if(pres.gt.1.0d0)then write(6,*)'readin. input surface pressure is greater', &' than 1atm. Will reset it to 1atm.' pres=1.0d0 endif if(lprt)write (*, *) 'PRES = ', pres c read the solar zenith angles read(22,'(A)') inline read(inline,*) nthet if(lprt)write (*,*) 'NTHET = ', nthet call chkpar(nthet,max_sza,'NTHET',5) IF(index(inline,'mu') .NE. 0)then write(6,*)'am reading mu ' read (22,*) (theta(num),num=1,nthet) do num=1,nthet theta(num)=acos(theta(num))*180.0d0/acos(-1.0d0) enddo else read (22,*) (theta(num),num=1,nthet) endif !def if(lprt)write (*,*) 'THETA = ', (theta(num),num=1,nthet) c read the scan angles read(22,'(A)') inline read(inline,*) nscan if(lprt)write (*,*) 'NSCAN = ',nscan call chkpar(nscan,max_scan,'NSCAN',5) IF(index(inline,'mu') .NE. 0)then write(6,*)'am reading mu ' read (22,*) (scan(num), num=1, nscan) do num=1,nscan !def scan(num)=acos(scan(num))*180.0d0/acos(-1.0d0) !def enddo !def else read (22,*) (scan(num), num=1, nscan) endif !def if(lprt)write (*,*) 'SCAN = ', (scan(num),num=1,nscan) read (22,*) naz if(lprt)write (*,*) 'NAZ = ',naz call chkpar(naz,max_az,'NAZ',3) read (22,*) (azmth(num), num=1, naz) if(lprt)write (*,*) 'azmth = ', (azmth(num),num=1, naz) read (22,*) nalb if(lprt)write (*,*) 'NALB = ',nalb call chkpar(nalb,max_alb,'NALB',4) read (22,*) (alb(num), num=1, nalb) if(lprt)write (*,*) 'ALB = ', (alb(num),num=1,nalb) read (22, *) wavel_start, wavel_stop if(lprt)write (*, *) 'START, stop = ', wavel_start, wavel_stop if(prf_type.eq.1)then read (22,*,err=3000) n_p_lay if(lprt)write (*, *) 'n_p_lay = ', n_p_lay call chkpar(n_p_lay,max_n_p_lay,'n_p_lay',7) read (22,*) (p_lay(num),num=n_p_lay,1,-1) else n_p_lay=11 endif read (22,*) (xprf(num),num=n_p_lay,1,-1) read (22,*) (tmpprf(num),num=n_p_lay,1,-1) c estimate surface temp based upon crude lapse rate of bottom 2 layers tmpsfc=tmpprf(n_p_lay)+0.5*(tmpprf(n_p_lay)-tmpprf(n_p_lay-1)) c if(lprt)write (*,*) 'Ozone profile =',xprf if(lprt)write (*,*) 'Temp profile =',tmpprf read (22,*) (jprint(i),i=1,10) if(lprt)write (*,*) 'jprint =', (jprint(i),i=1,10) read (22,*) num_iter if(lprt)write (*,*) 'NUM_ITER = ', num_iter call chkpar(num_iter,max_num_iter,'NUM_ITER',8) read (22,*) (wave_iter(i),i=1,num_iter) read (22,*) (iter(i),i=1,num_iter) c fill the other iter values with the max# of iters do i=num_iter+1,max_num_iter iter(i)=max_num_iter enddo c if(lprt)write (*,*) (wave_iter(i), i=1,num_iter) if(lprt)write (*,*) (iter(i),i=1,num_iter) read (22,*) ipol if(lprt)write (*,*) 'IPOL = ', ipol close (22) imuz = nthet imu = nscan iazmth =naz do i=1, nthet thnot(i) = theta(i) end do do i = 1, nscan thta(i) = scan(i) end do return 3000 if(n_p_lay.eq.0)then write(6,*)'readin. error reading the # of pressure layers', &' for the umkher-type input file' write(6,*)'readin. n_p_lay = ',n_p_lay stop endif return end c c subroutine chkpar(i,j,name,l) c c check the value of i and set to j if greater than j c print name if need to set value of i. c implicit none c integer i,j,l character name(l) c local c if(i.gt.j)then write(6,*)'chkpar. must reset the value of ',name,' from ', &i,' to ',j i=j endif return end