      program make_dk_data
      implicit none
      include 'max.inc'
      include 'formats.inc'
c
c     Purpose: to generate dummy sets of d(k)/d(T) and d(k)/d(X) data
c
c     Variables
      integer data_type
      integer lay,band,quad,ix
      integer Nlay,Nx,Nb,Nq
      double precision dka_dT(1:Nlay_mx,1:Nb_mx,1:Nq_mx)
      double precision dka_dX(1:Nlay_mx,1:Nb_mx,1:Nq_mx,1:Nx_mx)
      character*(Nchar_mx) dkdT_file,dkdX_file
c     label
      integer strlen
      character*(Nchar_mx) label
      label='program make_dk_data'

      data_type=1 ! 1: GCM data; 2: standard profiles

      if (data_type.eq.1) then
c     terrestrial GCM data
         Nlay=20
         Nb=38
         Nq=16
         Nx=2
         dkdT_file='./dkdT0.txt'
         dkdX_file='./dkdX0.txt'
      else if (data_type.eq.2) then
c     standard profiles
         Nlay=49
         Nb=131
         Nq=16
         Nx=2
         dkdT_file='./std_dkdT_i1.txt'
         dkdX_file='./std_dkdX_i1.txt'
      else
         call error(label)
         write(*,*) 'data_type=',data_type
         write(*,*) 'allowed values: 1, 2'
         stop
      endif

c     Dummy d(ka)/d(T) data
      do lay=1,Nlay
         do band=1,Nb
            do quad=1,Nq
               dka_dT(lay,band,quad)=1.0D+0 ! m^-1.K^-1
            enddo               ! quad
         enddo                  ! band
      enddo                     ! i
c     Dummy d(ka)/d(X) data
      do lay=1,Nlay
         do band=1,Nb
            do quad=1,Nq
               do ix=1,Nx
                  dka_dX(lay,band,quad,ix)=1.0D+0 ! m^-1/[x]
               enddo            ! ix
            enddo               ! quad
         enddo                  ! band
      enddo                     ! i

      open(10,file=dkdT_file(1:strlen(dkdT_file)))
      do band=1,Nb
         do quad=1,Nq
c     dka_dT(lay,band,quad) is the sensitivity of ka(lay,band,quad) to
c     temperature in layer index "lay" T(lay)
            write(10,49) (dka_dT(lay,band,quad),lay=1,Nlay)
         enddo                  ! quad
      enddo                     ! band
      close(10)

      open(10,file=dkdX_file(1:strlen(dkdX_file)))
      write(10,*) Nx
      do band=1,Nb
         do quad=1,Nq
c     dka_dX(lay,band,quad,ix) is the sensitivity of ka(lay,band,quad) to
c     the concentration of species index "ix", X(ix)
            do ix=1,Nx
               write(10,49) (dka_dX(lay,band,quad,ix),lay=1,Nlay)
            enddo               ! ix
         enddo                  ! quad
      enddo                     ! band
      close(10)

      end
