      program read_optprop
c     Very simple program template to check GCM aerosol optical properties    
c     example : read_optprop < optprop_dustvis_TM_n50.dat > output
c     FF 2011

      integer nwvl,nsize
      integer nwvlmax,nsizemax
      parameter (nwvlmax=100,nsizemax=100)
      real wvl(nwvlmax),radius(nsizemax)
      real Qext(nwvlmax,nsizemax)
      real omega(nwvlmax,nsizemax)
      real g(nwvlmax,nsizemax)
      read(*,*)
      read(*,*) nwvl
      read(*,*)
      read(*,*) nsize
      read(*,*)
      read(*,*) (wvl(iwvl),iwvl=1,nwvl) 
      read(*,*)
      read(*,*) (radius(isize),isize=1,nsize) 
      read(*,*)  ! Extinction coef. Qext
      do isize = 1,nsize
          read(*,*)  !Radius number 
          read(*,*) (Qext(iwvl,isize),iwvl=1,nwvl)
      end do
      read(*,*)  ! Single Scat Albedo (omeg)
      do isize = 1,nsize
          read(*,*)  !Radius number 
          read(*,*) (omega(iwvl,isize),iwvl=1,nwvl)
      end do
      read(*,*)  ! Assymetry Factor (gfactor)
      do isize = 1,nsize
          read(*,*)  !Radius number 
          read(*,*) (g(iwvl,isize),iwvl=1,nwvl)
      end do

c     ********************************************************************
c       Output after reading 
      do iwvl = 1,nwvl
        if (wvl(iwvl).eq.0.213298E-04) then
          do isize = 1,nsize
             write(*,*) radius(isize),Qext(iwvl,isize)
               write(11,*) radius(isize),Qext(iwvl,isize)
c    &                  ,  min(2.4,(0.07+5E6*radius(isize))**4)
c    &                  ,  min(2.4,(0.07+4.9E6*radius(isize))**4)
          end do
        end if
      end do
c     ********************************************************************
      

      end 
       
      



