!--------------------------------------------------------!
! $BI=Bj(B: $B=i4|CM:n@.%W%m%0%i%`(B
! $BMzNr(B: 2003/09/17
!--------------------------------------------------------!
program make_init
  use prm, only : IMAX,   &   ! x $B3J;R?t(B
&                 JMAX,   &   ! y $B3J;R?t(B
&                 KMAX,   &   ! z $B3J;R?t(B
&                 DX          ! $B3J;R4V3V(B (km)
  implicit none

   character(LEN=100) :: HEAD
   integer            :: IDATE
   integer            :: KT                        

   integer            ::  k 

   real(8)            :: H(1:IMAX, 1:JMAX)
   real(8)            :: B(1:IMAX, 1:JMAX)
   real(8)            :: T(1:IMAX, 1:JMAX, 1:KMAX)

   HEAD = '2DICE-SHEET_pre'
   IDATE = -1
   KT = 0 
   

   call rs_read(HEAD, IDATE, KT, H, B, T)


   write(6, *)'write GRADS file'
   open(10, file='GRADS.init_ICE-SHEET', form='unformatted', &
        & access='direct', recl=4*IMAX*JMAX)
   
   write(10, rec=1)REAL(H)
   write(10, rec=2)REAL(B)
   do k = 0, KMAX
      write(10, rec=k+3)REAL(T(:, :, k))
   end do
   

   close(10)

end program make_init
