c calculate the alternate 3-D analytic signal
      character id*56, ifile*50
      dimension x(2048),y(2048),zx(2048),zy(2048)
      call pfinit('analyti2')
      print *,'enter x-derivative file name:'
      read(5,100) ifile
  100 format(a)
c      open(12,file=ifile,form='unformatted',status='old')
      call gopen(12,ifile,'old','read',ierr)
      print *,'enter y-derivative file name:'
      read(5,100) ifile
c      open(13,file=ifile,form='unformatted',status='old')
      call gopen(13,ifile,'old','read',ierr)
      print *,'enter zx-derivative file name:'
      read(5,100) ifile
c      open(14,file=ifile,form='unformatted',status='old')
      call gopen(14,ifile,'old','read',ierr)
      print *,'enter zy-derivative file name:'
      read(5,100) ifile
c      open(15,file=ifile,form='unformatted',status='old')
      call gopen(15,ifile,'old','read',ierr)
c      read(12) id,pgm,nc,nr,nz,xo,dx,yo,dy
      call gheader('r',12,id,nc,nr,xo,dx,yo,dy,ierr)
c      read(13) id
      call gheader('r',13,id,nc,nr,xo,dx,yo,dy,ierr)
c      read(14) id
      call gheader('r',14,id,nc,nr,xo,dx,yo,dy,ierr)
c      read(15) id
      call gheader('r',15,id,nc,nr,xo,dx,yo,dy,ierr)
      print *,'enter output file name:'
      read(5,100) ifile
c      open(16,file=ifile,form='unformatted',status='unknown')
      call gopen(16,ifile,'new','write',ierr)
c      pgm='analytic'
      id='analytic signal'
c      write(16) id,pgm,nc,nr,nz,xo,dx,yo,dy
      call gheader('w',16,id,nc,nr,xo,dx,yo,dy,ierr)
      do 20 j=1,nr
c      read(12) dlt,(x(i),i=1,nc)
      call grow('r',12,dlt,x,nc,ierr)
c      read(13) dlt,(y(i),i=1,nc)
      call grow('r',13,dlt,y,nc,ierr)
c      read(14) dlt,(zx(i),i=1,nc)
      call grow('r',14,dlt,zx,nc,ierr)
c      read(15) dlt,(zy(i),i=1,nc)
      call grow('r',15,dlt,zy,nc,ierr)
      do 10 i=1,nc
      x(i)=sqrt(x(i)**2 + y(i)**2 + zx(i)**2 + zy(i)**2)
   10 continue
c      write(16) dlt,(x(i),i=1,nc)
      call grow('w',16,dlt,x,nc,ierr)
   20 continue
      call gclose(12,'keep')
      call gclose(13,'keep')
      call gclose(14,'keep')
      call gclose(15,'keep')
      call gclose(16,'keep')
c      stop
      end
