program readsavefile
  implicit none

! CHANGE THIS PARAMETERS
  integer , parameter :: iy = 64
  integer , parameter :: jx = 72
  integer , parameter :: kz = 18
! CHANGE THIS PARAMETERS

  integer , parameter :: iutrst = 101
  integer :: k
  integer :: mdate0 , ktau , xtime , ldatez , lyear , lmonth , lday ,&
           & lhour , ntime
  character(256) :: savefile , prgname
  real(8) , dimension(iy,jx,kz) :: ub0, vb0, qb0, tb0
  real(8) , dimension(iy,jx)    :: ps0, ts0

  call getarg(0, prgname)
  call getarg(1, savefile)

  open (iutrst,file=savefile,form='unformatted',status='old')

  read (iutrst) mdate0
  read (iutrst) ktau, xtime, ldatez, lyear, lmonth, lday, lhour, ntime
  read (iutrst) ub0, vb0, qb0, tb0, ps0, ts0

  print *, mdate0
  print *, ktau, xtime, ldatez, lyear, lmonth, lday, lhour, ntime

  do k = 1, kz
    print *, ub0(:,:,k)/ps0(:,:)
  end do

  close (iutrst)

end program readsavefile
