program CIGnorm
  !! CIG normalize
  !! Paul Sava (paul@sep.stanford.edu)
  !! 02/27/2003

  !! input:  z-ax-mx-ro (ADCIG)
  !! output: z-   mx-ro (ADCIG normalized)

  use sep
  implicit none

  real, dimension(:,:,:), allocatable :: adcig
  integer :: method
  integer :: nz,nmx,nax, nro
  integer :: iro

  call sep_init()

  call from_history("n1",nz )
  call from_history("n2",nax)
  call from_history("n3",nmx)
  call from_history("n4",nro,1)

  allocate(adcig(nz,nax,nmx)); adcig=0

  do iro=1,nro
     write (0,*) "ro=",iro
     call sep_read(adcig)
     adcig = adcig/maxval(abs(adcig))
     call sep_write(adcig)
  end do

  call sep_close()
  deallocate(adcig)

  call exit(0)
end program CIGNORM













