subroutine rdatar(iyear,idoy,endorb,enddat,error) c c*********************************************************************** c c rdatar c c september, 2001 by charlie wellemeyer ssai c c purpose: c reads one record of data from the pmf file c c method c reads data record, checks for end of file c c calling sequence: c call rdatar(endorb,enddat,error) c c variables: c name type i/o description c ---- ---- --- ----------- c arguments c iyear i*4 o year of current scan c idoy i*4 o day of year of current scan c endorb l*4 o end of orbit flag c enddat l*4 o end of data flag c error l*4 o error flag c c common /buffin/ c buf(207) r*4 o buffer containing one pmf data record c c common/countr/ c nfcntr i*4 o file processing counters c c common/contrl/ c lprint(30) l*4 i printout control flags c lprint(4) debug c common/prfprm/ c nval_obs r*8 o measured n-values at profiling wavelengths c c calling routine oproc c c modification c c*********************************************************************** c implicit none c integer*4 i, j, lseq, irec real*8 convrt,biggain data convrt /57.29577951d0/ equivalence (buf(67),biggain) c include 'adjust.com' include 'countr.com' include 'contrl.com' include 'totret.com' include 'buffin.com' c integer n, nc, ns, nitr, nref parameter (n = 81, nc = 10, ns = 8, nitr = 8, nref = 1410) include 'prfprm.com' c logical*4 endorb,enddat,error real*4 thousn/1000.0/ integer iyear,idoy c c**** read a data record c 100 continue read(11,end=900,err=910) buf lseq=buf(2) if(lseq.eq.1) go to 100 if(lseq .gt. 0) nfcntr(2)=nfcntr(2)+1 c if(lseq .lt. -1) endorb=.true. if(lseq .eq. -1) enddat=.true. c c**** move real*4 buffer to real quantities c iyear=buf(4)/1000 idoy=amod(buf(4),thousn) iorbit=nint(buf(3)) igmt=nint(buf(5)) xlat=buf(48) xlon=buf(49) sza=buf(50) if(sza.gt.88.0) go to 100 pteran=buf(44) pclsat=buf(22) do i=1,8 xnvalp(i) = buf(i+50)/100.0 xnvalm(i) = (buf(i+58)+adjn(i))/100.0 enddo do i=9,12 j=23-i xnvalp(i) = buf(j)/100.0 j=27-i xnvalm(i) = (buf(j)+adjn(i))/100.0 enddo do i=1,10 nval_obs(i) = xnvalm(i) * 100.0 enddo szabeg = buf(206)*convrt/10000.0 szaend = buf(207)*convrt/10000.0 isnow = 0 isface = 0 if(buf(40).lt.0.0) go to 100 c return c c**** for end of file before a trailer record-print an error message c 900 continue c write(6,9000) buf(5) print*,'end of data exit',nfcntr(2) if (nfcntr(2).gt.0) endorb=.true. enddat=.true. return c c**** skip the entire block of records for read errors c 910 write(6,9100) print*,'read error exit' error=.true. c 9000 format(/6x,'*** caution- no trailer record found on present pmf ', 1 'file'/10x,'end of file'/ 2 10x,'gmt of last record on file: ',i5) 9100 format(/6x,'*** pmf read error ***') c end