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