      subroutine dtailt(iseq,iyear,idoy,iorbit,igmt,fgprf,
     1     resn,sens,rsens,qu_a,tu_a,radmsr,rad,radss,dndom,
     2     dndxmsr,dndx,dndxss,delnt,sza12,p_cld,
     3     p_terr,cldfrac)
c
c***********************************************************************
c
c     purpose
c        writes dtailed data records for first guess total ozone
c
c     variables
c       name        type   i/o  description
c       ----        ----   ---  -----------
c
c      common /buffout/
c       bufo(1)      i*4    i   logical sequence number
c       bufo(2)      i*4    i   year
c       bufo(3)      i*4    i   day of year
c       bufo(4)      i*4    i   orbit number
c       bufo(5)      i*4    i   seconds of day
c       bufo(6)      r*4    i   ifov latitude
c       bufo(7)      r*4    i   ifov longitude
c       bufo(8)      r*4    i   solar zenith angle
c       bufo(9)      r*4    i   solar zenith angle at start of scan
c       bufo(10)     r*4    i   solar zenith angle at end of scan
c       bufo(11-22)  r*4    i   12 monochromator n-values
c       bufo(23-34)  r*4    i   12 ccr n-values
c       bufo(35)     r*4    i   gain ranges for channels 1-4
c       bufo(36)     r*4    i   gain ranges for channels 5-8
c       bufo(37)     r*4    i   gain ranges for channels 9-12
c       bufo(38)     r*4    i   surface category code
c       bufo(39)     r*4    i   snow probability indicator
c       bufo(40)     r*4    i   surface pressure from climatology
c       bufo(41)     r*4    i   cloud pressure from climatology
c       bufo(42)     r*4    i   cloud pressure from satellite
c       bufo(43)     r*4    i   first guess total ozone
c       bufo(44)     r*4    i   cloud fraction at total ozone channel
c       bufo(45)     r*4    i   surface reflectivity at total ozone channel
c       bufo(46)     r*4    i   perturbed surface reflectivity
c       bufo(47)     r*4    i   estimated ozone below cloud
c       bufo(48)     r*4    i   algorithm indicator flag
c       bufo(49)     r*4    i   error indicator flag
c
c  output buffer array: buf
c
c     fgprf(11)      r*4    i   first guess ozone profile (11 umker lyrs)
c     resn(8)        r*4    i   first guess residues at 8 longest channels
c     sens(8)        r*4    i   total ozone sensitivities at 8 longest chan
c     rsens(8)       r*4    i   reflectivity sensitivities at 8 longest chan
c     qu_a(13)       r*4    i   a priori ozone profile (13 umkehr layers)
c     tu_a(13)       r*4    i   a priori temperature profile (13 umkehr layers)
c     radmsr(8)      r*4    i   msr radiance at 8 longest channels
c     rad(8)         r*4    i   total radiance at 8 longest channels
c     radss(8)       r*4    i   single scattered radiance at 8 longest channels
c     dndom(8)       r*4    i   total ozone sensitivity at 8 longest channels
c     dndxmsr(8,11)  r*4    i   msr layer sensitivities at 8 longest channels
c     dndx(8,11)     r*4    i   total layer sensitivities at 8 longest channels
c     dndxss(8,11)   r*4    i   ss layer sensitivities at 8 longest channels
c     delnt(8)       r*4    i   a priori temp n-value adjustment at 8 chans
c     sza12(12)      r*4    i   solar zenith angles at all 12 channels
c     p_cld          r*4    i   cloud top pressure
c     p_terr         r*4    i   terrain pressure
c     cldfrac(10)    r*4    i   cloud fractions determined at profile wavel
c
c     calling routine  total
c
c******************************************************************
c
      implicit none
c
      integer i,j,k,iseq,iyear,idoy,iorbit,igmt
      real*4 buf(389)
      real fgprf(11),resn(8),sens(8),rsens(8),
     1   qu_a(13),tu_a(13),radmsr(8),rad(8),radss(8),dndom(8),
     2   dndxmsr(8,11),dndx(8,11),dndxss(8,11),delnt(8),
     3   sza12(12),p_cld,p_terr,cldfrac(10)
c
      include 'buffout.com'
      include 'contrl.com'
c
      do j=1,11
        buf(j)=fgprf(j)
        do i=1,8
          k=8*(j-1)+i
          buf(k+93)=dndxmsr(i,j)
          buf(k+181)=dndx(i,j)
          buf(k+269)=dndxss(i,j)
        enddo
      enddo
c
      do i=1,8
        buf(i+11)=resn(i)
        buf(i+19)=sens(i)
        buf(i+27)=rsens(i)
        buf(i+61)=radmsr(i)
        buf(i+69)=rad(i)
        buf(i+77)=radss(i)
        buf(i+85)=dndom(i)
        buf(i+357)=delnt(i)
      enddo
c
      buf(378)=p_cld
      buf(379)=p_terr
      do i=1,10
        buf(i+379)=cldfrac(i)
      enddo
c
      do i=1,12
        buf(i+365)=sza12(i)
      enddo
c
      do i=1,13
        buf(i+35)=qu_a(i)
        buf(i+48)=tu_a(i)
      enddo
c
c  write portion of oz-s buffer to detail file on unit 15
c
c     bufo(1) = iseq
c     bufo(2) = iyear
c     bufo(3) = idoy
c     bufo(4) = iorbit
c     bufo(5) = igmt
      if(.not.iopts(3)) write(15) (bufo(i),i=1,49)
c
c  write additional detailed parameters to unit 15
c
      if(.not.iopts(3)) write(15) buf
c
      return
c
      end
