C*********************************************************************
C
C     PROGRAM taudv
C
C     ダスト光学的厚さ時系列
C
C     2000/11/23 小高正嗣
C
C*********************************************************************
      program taudv
C---------------------------------------------------------------------  
      IMPLICIT REAL*8 ( A-H, O-Z )                                      
C---------------------------------------------------------------------  
#include "grid_size_M.f"
      parameter ( nzprof = 100 )                              
      parameter ( nzp = nz+1   )
*-----------------------------------------------------
      parameter ( day = 86400.0 )
      parameter ( hour = 3600.0 )
      parameter ( PI = 3.241592 )
      parameter ( NT = 1000 )

      real*4 QALL(0:NT), TAU(0:NT)
      real*4 TIMEL(0:NT)
      real*4 TMAX, TMIN

      character CSGI*1

*-----------------------------------------------------
      
      open (11,file='exparam')
      read (11,*) irun
      read (11,*) time0, nloop1, nloop2, dtime, ntmoni, ntkubu, times
      read (11,*) ylat, als
      close(11)

      call SETDUST
     O   ( QEXT_SR, QEXT_IR1, QEXT_IR2, 
     O     QALB_SR, QALB_IR1, QALB_IR2, 
     O     QASM_SR, QASM_IR1, QASM_IR2,
     O     QDENS  , QREFF   , QRMOD     )

      open(12)

      do it = 0, 143
         read(12,*) TIMEL(it)
      end do

      do it = 0, 143
         read(12,*) QALL(it)
      end do

      close(12)

      do it = 0, 143
         TIMEL(it) = ( TIMEL(it) - TIME0 ) / HOUR
         TAU(it) = 3.0 * QEXT_SR * QALL(it) / 
     \        ( QREFF * QDENS * 4.0 * PI ) / 51200.0 
      end do

      TMAX = TIMEL(0)
      TMIN = TMIN
      do it = 0,143
         TMAX = MAX ( TMAX, TIMEL(it) ) 
         TMIN = MIN ( TMIN, TIMEL(it) ) 
      end do

      call sgpwsn
      read(*,*) iws

      CALL SWISET('IWIDTH',  640)
c      CALL SWISET('IHEIGHT', 540)
      CALL SWISET('IHEIGHT', 300)
      call swlset( 'LDUMP', .TRUE. )

      call gropn(iws)
      call sglset( 'LFULL', .TRUE. )
      call sglset( 'LCORNER', .FALSE. )
      call uzfact(0.6)

      call grfrm
      CALL sglset( 'LCHAR', .FALSE. )
      call grswnd( TMIN, TMAX, 0.0, 1.0 )   
C      call grswnd( TMIN, TMAX, 0.0, 0.5 )   
      call grsvpt( 0.15, 0.95, 0.10, 0.412)                     
      call grstrn( 1 )
      call grstrf
      call ussttl( 'Time', 'Hour', CSGI(170), '' )
      call usdaxs

      call sgspli( 23 )
      call sgplu ( 143, TIMEL, TAU )

C      call uulinz(143, TIMEL, TAU, 1, 3  )
               
    
      call grcls                                                        

      end



