!=================================================================
!  一次元 CO2 大気放射対流平衡計算プログラム; 
!  DCL による描画(動画用)
!
!  1999/05/31  小高正嗣
!  1999/06/04  小高正嗣
!=================================================================

      subroutine dclanim
     I   ( ZGRID, TIME ,
     I     QVAL1, QVAL2, QVAL3, QVAL4,
     D     NZ   , NZB                     )

!-----------------------------------------------------------------      
      implicit real*8 ( a-h,o-z )
!-----------------------------------------------------------------      

      dimension
     \   ZGRID(-2:NZB),
     \   QVAL1(-2:NZB), 
     \   QVAL2(-2:NZB), 
     \   QVAL3(-2:NZB), 
     \   QVAL4(-2:NZB)

      real*4
     \   ZGRID_p(0:NZ),
     \   QVAL1_p(0:NZ), 
     \   QVAL2_p(0:NZ), 
     \   QVAL3_p(0:NZ), 
     \   QVAL4_p(0:NZ) 

      real*4
     \   ZMIN , ZMAX ,
     \   Q1MAX, Q1MIN,
     \   Q2MAX, Q2MIN,
     \   Q3MAX, Q3MIN,
     \   Q4MAX, Q4MIN

      character*5 header

!-----------------------------------------------------------------      

      write(header,'(I5.5)') INT( TIME/3600.0 )

      NZP = NZ

      do iz = 0, NZ
         QVAL1_p(iz) = real( QVAL1(iz) )
         QVAL2_p(iz) = real( QVAL2(iz) )
         QVAL3_p(iz) = real( QVAL3(iz) )*86400.0
         QVAL4_p(iz) = real( QVAL4(iz) )*86400.0

         ZGRID_p(iz)= real( ZGRID(iz) )/ 1000.0
      end do

      ZMIN    = ZGRID_p(0)
      ZMAX    = ZGRID_p(NZP)

      Q1MIN    = QVAL1_p(0)
      Q1MAX    = QVAL1_p(0)
      Q2MIN    = QVAL2_p(0)
      Q2MAX    = QVAL2_p(0)
      Q3MIN    = QVAL3_p(0)
      Q3MAX    = QVAL3_p(0)
      Q4MIN    = QVAL4_p(0)
      Q4MAX    = QVAL4_p(0)

      do iz = 0, NZP
         Q1MAX    = MAX( Q1MAX, QVAL1_p(iz), 1.0e-6 )
         Q1MIN    = MIN( Q1MIN, QVAL1_p(iz) )
         Q2MAX    = MAX( Q2MAX, QVAL2_p(iz), 1.0e-6 )
         Q2MIN    = MIN( Q2MIN, QVAL2_p(iz) )
         Q3MAX    = MAX( Q3MAX, QVAL3_p(iz), 1.0e-6 )
         Q3MIN    = MIN( Q3MIN, QVAL3_p(iz) )
         Q4MAX    = MAX( Q4MAX, QVAL4_p(iz), 1.0e-6 )
         Q4MIN    = MIN( Q4MIN, QVAL4_p(iz) )
      end do

      CALL grfrm                                                              
      CALL grswnd( 0.0, 2000.0, ZMIN, ZMAX )   
      CALL grsvpt( 0.2, 0.8, 0.2, 0.8)                     
      CALL grstrn( 1 )
      CALL grstrf
      call ussttl( 'Ptemp', '[]', '', 'Z[km]' )
      CALL usdaxs
      CALL uuslni( 2 )
      CALL uulin( NZP+1, QVAL1_p, ZGRID_p )
      call uxsttl( 'T', header, 1. )      

      CALL grfrm                                                              
      CALL grswnd( 0.0, 100.0, ZMIN, ZMAX )   
      CALL grsvpt( 0.2, 0.8, 0.2, 0.8)                     
      CALL grstrn( 1 )
      CALL grstrf
      call ussttl( 'dT/dt', '[]', '', 'Z[km]' )
      CALL usdaxs
      CALL uuslni( 2 )
!      CALL uuslnt( 3 )
      CALL uulin( NZP+1, QVAL3_p, ZGRID_p )
!      CALL uuslni( 2 )
!      CALL uuslnt( 1 )
!      CALL uulin( NZP+1, QVAL4_p, ZGRID_p )

c      CALL grcls                                                        

      return

      end

