module OW_parms_areal

use sep
use OW_type

implicit none

logical,public, save					:: encode
type (axis) ,public, save				:: kxm, h, w, x, xm, z, sh
type (dat_grid)	 ,public, save				:: rec, sou
type (mod_grid)	 ,public, save				:: img
type (velo) ,public, save				:: v
integer	 ,public, save					:: nref,iwb,ikxa,tapertr,padtraces,dref,imgxn,nsh_img,isp,nphi,n_wind
real ,public, save					:: xmin,xmax,ymin,ymax,zmin,zmax,pi,wbott,vsal,dphi,ophi,deltat
real,public,save,allocatable				:: windf(:)

contains

subroutine owparam(migrate)

logical							:: migrate
real							:: depth_wav,imgxo,imgxd,a,std,b
real, allocatable						:: temp(:)

if (migrate) then

 call from_history("n1",rec%h%n);	call from_history("d1",rec%h%d);	call from_history("o1",rec%h%o)
 call from_history("n3",rec%w%n);	call from_history("d3",rec%w%d);	call from_history("o3",rec%w%o)
 call from_history("n4",rec%x%n);	call from_history("d4",rec%x%d);	call from_history("o4",rec%x%o)  

 call from_aux("sou","n1",sou%h%n);	call from_aux("sou","d1",sou%h%d);	call from_aux("sou","o1",sou%h%o)
 call from_aux("sou","n3",sou%w%n);	call from_aux("sou","d3",sou%w%d);	call from_aux("sou","o3",sou%w%o)
 call from_aux("sou","n4",sou%x%n);	call from_aux("sou","d4",sou%x%d);	call from_aux("sou","o4",sou%x%o)  

 call from_aux("vel","n1",v%z%n);	call from_aux("vel","d1",v%z%d);	call from_aux("vel","o1",v%z%o)
 call from_aux("vel","n2",v%xm%n);	call from_aux("vel","d2",v%xm%d);	call from_aux("vel","o2",v%xm%o)

 if (sou%w%n .ne. rec%w%n) then
    call seperr("# source freq. .ne. # receiver freq.")
 end if
 if (sou%x%n .ne. rec%x%n) then
    call seperr("# source planes. .ne. # receiver planes")
 end if
 if (sou%h%n .ne. rec%h%n) then
    call seperr("# source traces. .ne. # areal shot traces")
 end if
 if (sou%w%d .ne. rec%w%d) then
    call seperr("source freq.interval .ne. receiver freq.interval")
 end if
 if (sou%h%d .ne. rec%h%d) then
    call seperr("source trace interval .ne. areal shot trace interval")
 end if
 if (sou%x%d .ne. rec%x%d) then
    call seperr("source plane interval .ne. areal shot plane interval")
 end if
 if (sou%w%o .ne. rec%w%o) then
    call seperr("source freq.origin .ne. receiver freq.origin")
 end if
 if (sou%x%o .ne. rec%x%o) then
    call seperr("source plane origin .ne. areal shot plane origin")
 end if
 if (sou%w%o .ne. rec%w%o) then
    call seperr("source origin .ne. areal shot origin")
 end if

 !!  get parameters
  call from_param("nrefvel",nref) 
  call from_param("xmin",xmin) 
  call from_param("xmax",xmax)
  call from_param("ymin",ymin,0.)
  call from_param("ymax",ymax,0.)
  call from_param("zmin",zmin,0.)
  call from_param("zmax",zmax)
  call from_param("wbott",wbott,0.)
  call from_param("nh",img%sh%n,1)
  call from_param("oh",img%sh%o,0.)
  call from_param("dh",img%sh%d,0.)
  call from_param("wbott",wbott,0.)
  call from_param("vsal",vsal)
  call from_param("traces_in_taper",tapertr,0)
  call from_param("padtraces",padtraces,tapertr)
  call from_param("deltat",deltat,0.1)
  call from_param("std",std,1.)
  b=.68
  if (std .ne. 1) then
     std = 2
     b = 0.95
  end if

  imgxn=floor((xmax-xmin)/v%xm%d)+1
  imgxd=v%xm%d
  imgxo=xmin

!  img%xm%n=imgxn+2*padtraces
!  img%xm%d=v%xm%d
!  img%xm%o=imgxo-padtraces*img%xm%d

  img%xm%n=rec%h%n
  img%xm%d=rec%h%d
  img%xm%o=rec%h%o

 if (xmin < v%xm%o ) call seperr("Min.x-image space < Min.x-velocity")
 if (xmax > v%xm%o+(v%xm%n-1)*v%xm%d ) call seperr("Max.x-image space > Max.x-velocity")

 if (zmin < v%xm%o ) call seperr("Min.z-image space < Min.z-velocity")
 if (zmax > v%z%o+(v%z%n-1)*v%z%d ) call seperr("Max.z-image space > Max.z-velocity")

 img%z%n=floor((zmax-zmin)/v%z%d)+1
 img%z%o=zmin
 img%z%d=v%z%d

! if (wbott.ne.0.) then
!    call to_history("n1",rec%h%n,"dat");call to_history("d1",rec%h%d,"dat");call to_history("o1",rec%h%o,"dat")
!    call to_history("n3",rec%w%n,"dat");call to_history("d3",rec%w%d,"dat");call to_history("o3",rec%w%o,"dat")
!    call to_history("n4",rec%x%n,"dat");call to_history("d4",rec%x%d,"dat");call to_history("o4",rec%x%o,"dat")  
!    call to_history("n2",1,"dat"); call to_history("d2",1,"dat"); call to_history("o2",1,"dat")
!    call to_history("n5",1,"dat"); call to_history("d5",1,"dat"); call to_history("o5",1,"dat")  
!    call to_history("esize",8,"dat")
! end if

!----------------------------------------------
!
! Migration output
!

 call to_history("n1",img%z%n) ; call to_history("d1",img%z%d) ; call to_history("o1",img%z%o)
 call to_history("n2",img%sh%n) ; call to_history("d2",img%sh%d) ; call to_history("o2",img%sh%o)
 call to_history("n3",img%xm%n); call to_history("d3",img%xm%d); call to_history("o3",img%xm%o)  
 call to_history("n4",rec%x%n); call to_history("d4",rec%x%d); call to_history("o4",rec%x%o)
! call to_history("n4",1); call to_history("d4",1); call to_history("o4",0)
 call to_history("n5",1); call to_history("d5",1); call to_history("o5",0)  
 call to_history("esize",4)

!if (exist_file("synsh")) then
!----------------------------------------------
!
! Synthesized areal shot
!
! call to_history("n1",rec%w%n,"synsh");	call to_history("d1",rec%w%d,"synsh");	call to_history("o1",rec%w%o,"synsh")
! call to_history("n2",1,"synsh");	call to_history("d2",1,"synsh"); 	call to_history("o2",1,"synsh")
! call to_history("n3",nsh_img,"synsh"); call to_history("d3",rec%h%d,"synsh");	call to_history("o3",rec%x%o+rec%h%o,"synsh")  
! call to_history("n4",1,"synsh"); 	call to_history("d4",1,"synsh"); 	call to_history("o4",1,"synsh")
! call to_history("n5",1,"synsh"); 	call to_history("d5",1,"synsh"); 	call to_history("o5",1,"synsh")  
! call to_history("esize",8,"synsh")
!end if

if(exist_file("G1")) then
 call to_history("n1",img%z%n,"G1") ; call to_history("d1",img%z%d,"G1") ; call to_history("o1",img%z%o,"G1")
 call to_history("n2",img%sh%n,"G1"); call to_history("d2",img%sh%d,"G1"); call to_history("o2",img%sh%o,"G1")
 call to_history("n3",img%xm%n,"G1"); call to_history("d3",img%xm%d,"G1"); call to_history("o3",img%xm%o,"G1")  
 call to_history("n4",floor(rec%w%n/10.),"G1"); call to_history("d4",rec%w%d*10,"G1"); call to_history("o4",rec%w%o,"G1")
 call to_history("n5",1,"G1"); call to_history("d5",1,"G1"); call to_history("o5",1,"G1")  
 call to_history("esize",4,"G1")
end if

if(exist_file("ws")) then
 call to_history("n1",img%z%n,"ws") ; call to_history("d1",img%z%d,"ws") ; call to_history("o1",img%z%o,"ws")
 call to_history("n2",img%xm%n,"ws"); call to_history("d2",img%xm%d,"ws"); call to_history("o2",img%xm%o,"ws")  
 call to_history("n3",rec%x%n,"ws"); call to_history("d3",rec%x%d,"ws"); call to_history("o3",rec%x%o,"ws")
 call to_history("n4",1,"ws"); call to_history("d4",1.,"ws"); call to_history("o4",1.,"ws")
 call to_history("n5",1,"ws"); call to_history("d5",1.,"ws"); call to_history("o5",1.,"ws")  
 call to_history("esize",4,"ws")
end if

if(exist_file("wr")) then
 call to_history("n1",img%z%n,"wr") ; call to_history("d1",img%z%d,"wr") ; call to_history("o1",img%z%o,"wr")
 call to_history("n2",img%xm%n,"wr"); call to_history("d2",img%xm%d,"wr"); call to_history("o2",img%xm%o,"wr")  
 call to_history("n3",rec%x%n,"wr"); call to_history("d3",rec%x%d,"wr"); call to_history("o3",rec%x%o,"wr")
 call to_history("n4",1,"wr"); call to_history("d4",1.,"wr"); call to_history("o4",1.,"wr")
 call to_history("n5",1,"wr"); call to_history("d5",1.,"wr"); call to_history("o5",1.,"wr")  
 call to_history("esize",4,"wr")
end if

pi=4*atan(1.)
isp=abs(floor(rec%h%o/rec%h%d)) + 1
!--------------------------------------------------
! Frequency vector
! no zero frequency component
!
rec%w%o   = 2*pi * rec%w%o
rec%w%d   = 2*pi * rec%w%d
allocate(rec%w%all(rec%w%n))
do iwb = 1,rec%w%n
   rec%w%all(iwb) = rec%w%o + (iwb - 1) * rec%w%d
end do
!--------------------------------------------------
! Wavenumber vector
!
kxm%n = img%xm%n
kxm%d = 1./(kxm%n* img%xm%d)
kxm%o = 1./(2* img%xm%d)-kxm%d
allocate(kxm%all(kxm%n))
do ikxa=1,kxm%n
   kxm%all(ikxa) = mod(kxm%o+(ikxa-1)*kxm%d,1./ img%xm%d)-kxm%o
end do
kxm%all = 2*pi * kxm%all

!--------------------------------------------------
!
! Gaussian window
!
allocate(temp(rec%w%n))
do iwb = 1,rec%w%n
   temp(iwb) = (iwb - 1) * rec%w%d
end do
temp=exp(-0.5*(temp*deltat/std)**2)
write(0,*) temp
a=0
n_wind=1
iwb=1
write(0,*) "*****std*sum(temp)*****", std*sum(temp),sum(temp)
do while (a < b*sum(temp))
   write(0,*) "***** a *****", a
   a=a+temp(iwb)
   n_wind=n_wind+1
end do
if (mod(float(n_wind),2.) == 0 ) n_wind=n_wind+1
write(0,*) "**** nwind****", n_wind
allocate(windf(n_wind))
windf=temp(1:n_wind)
!allocate(windf(rec%w%n));windf=0;
!do iwb=1,n_wind
!   windf(iwb+int(rec%w%n/2.))=temp(iwb)
!   windf(int(rec%w%n/2)-iwb+1)=temp(iwb+1)
!end do
!write(0,*) windf

deallocate(temp)

write(0,*) "   PARM   "
write(0,*) "=========="
write(0,*) "PARAMETERS"
write(0,*) "=========="
write(0,*) //
write(0,*) "no.ref.velocities   = ",nref
write(0,*) "min.x-coord         = ",xmin
write(0,*) "max.x-coord         = ",xmax
write(0,*) "min.y-coord         = ",ymin
write(0,*) "max.y-coord         = ",ymax
write(0,*) "min.depth           = ",zmin
write(0,*) "max.depth           = ",zmax
write(0,*) "max.limit velocity  = ",vsal
write(0,*) "traces in taper     = ",tapertr
write(0,*) "padded traces       = ",padtraces
write(0,*) //
write(0,*) "============"
write(0,*) "HEADER WORDS"
write(0,*) "============"
write(0,*) //
write(0,*) "SHOTS"
write(0,*) "====="
write(0,*) "number of recv  = ", rec%h%n
write(0,*) "recv spacing    = ", rec%h%d
write(0,*) "min.recv offset = ", rec%h%o
write(0,*) "number of freq  = ", rec%w%n
write(0,*) "freq spacing    = ", rec%w%d/(2*pi)
write(0,*) "minimum freq    = ", rec%w%o/(2*pi)
write(0,*) "number of shots = ", rec%x%n
write(0,*) "shot spacing    = ", rec%x%d
write(0,*) "min.shot-x      = ", rec%x%o
write(0,*) //
write(0,*) "SOURCE FUNCTION"
write(0,*) "==============="
write(0,*) "no.of traces    = ", sou%h%n
write(0,*) "trace spacing   = ", sou%h%d
write(0,*) "min.trace-x     = ", sou%h%o
write(0,*) "number of freq  = ", sou%w%n
write(0,*) "freq spacing    = ", sou%w%d
write(0,*) "minimum freq    = ", sou%w%o
write(0,*) "no.of s.fnct    = ", sou%x%n
write(0,*) "s.fnct spacing  = ", sou%x%d
write(0,*) "min.s.fnct-x    = ", sou%x%o
write(0,*) //
write(0,*) "VELOCITY MODEL"
write(0,*) "=============="
write(0,*) "no.of traces    = ", v%xm%n
write(0,*) "trace spacing   = ", v%xm%d
write(0,*) "min.trace-x     = ", v%xm%o
write(0,*) "no.depth samples= ", v%z%n
write(0,*) "depth interval  = ", v%z%d
write(0,*) "minimum depth   = ", v%z%o
write(0,*) //
write(0,*) "IMAGE SPACE"
write(0,*) "==========="
write(0,*) "no.of traces    = ", img%xm%n
write(0,*) "trace spacing   = ", img%xm%d
write(0,*) "min.trace-x     = ", img%xm%o
write(0,*) "no.depth samples= ", img%z%n
write(0,*) "depth interval  = ", img%z%d
write(0,*) "minimum depth   = ", img%z%o
write(0,*) //
write(0,*) "WAVENUMBER"
write(0,*) "=========="
write(0,*) "no.wavenumbers  = ", kxm%n
write(0,*) "waveno.spacing  = ", kxm%d
write(0,*) "waveno.origin   = ", kxm%o
write(0,*) //
!write(0,*) kxm%all

else

 call from_history("n1",rec%h%n);	call from_history("d1",rec%h%d);	call from_history("o1",rec%h%o)
 call from_history("n3",rec%w%n);	call from_history("d3",rec%w%d);	call from_history("o3",rec%w%o)
 call from_history("n4",rec%x%n);	call from_history("d4",rec%x%d);	call from_history("o4",rec%x%o)  

 call from_aux("sou","n1",sou%h%n);	call from_aux("sou","d1",sou%h%d);	call from_aux("sou","o1",sou%h%o)
 call from_aux("sou","n3",sou%w%n);	call from_aux("sou","d3",sou%w%d);	call from_aux("sou","o3",sou%w%o)
 call from_aux("sou","n4",sou%x%n);	call from_aux("sou","d4",sou%x%d);	call from_aux("sou","o4",sou%x%o)  

 call from_aux("vel","n1",v%z%n);	call from_aux("vel","d1",v%z%d);	call from_aux("vel","o1",v%z%o)
 call from_aux("vel","n2",v%xm%n);	call from_aux("vel","d2",v%xm%d);	call from_aux("vel","o2",v%xm%o)

 if (sou%w%n .ne. rec%w%n) then
    call seperr("# source freq. .ne. # receiver freq.")
 end if
 if (sou%w%d .ne. rec%w%d) then
    call seperr("source freq.interval .ne. receiver freq.interval")
 end if
 if (sou%w%o .ne. rec%w%o) then
    call seperr("source freq.origin .ne. receiver freq.origin")
 end if

 !!  get parameters
  call from_param("nrefvel",nref) 
  call from_param("xmin",xmin) 
  call from_param("xmax",xmax)
  call from_param("ymin",ymin,0.)
  call from_param("ymax",ymax,0.)
  call from_param("zmin",zmin,0.)
  call from_param("zmax",zmax)
  call from_param("wbott",wbott,0.)
  call from_param("nh",img%sh%n,1)
  call from_param("oh",img%sh%o,0.)
  call from_param("dh",img%sh%d,0.)
  call from_param("wbott",wbott,0.)
  call from_param("vsal",vsal)
  call from_param("traces_in_taper",tapertr,0)
  call from_param("padtraces",padtraces,tapertr)
  call from_param("depth_wav",depth_wav)
  call from_param("nphi",nphi,5)
  call from_param("dphi",dphi,10.)
  call from_param("ophi",ophi,-20.)
  call from_param("encode",encode)

  dref=floor(depth_wav/v%z%d)+1
  imgxn=floor((xmax-xmin)/v%xm%d)+1
  imgxd=v%xm%d
  imgxo=xmin

  img%xm%n=imgxn+2*padtraces
  img%xm%d=v%xm%d
  img%xm%o=imgxo-padtraces*img%xm%d


write(0,*) "1 ",depth_wav,img%z%d,dref

 if (xmin < v%xm%o ) call seperr("Min.x-image space < Min.x-velocity")
 if (xmax > v%xm%o+(v%xm%n-1)*v%xm%d ) call seperr("Max.x-image space > Max.x-velocity")

 if (zmin < v%xm%o ) call seperr("Min.z-image space < Min.z-velocity")
 if (zmax > v%z%o+(v%z%n-1)*v%z%d ) call seperr("Max.z-image space > Max.z-velocity")

 img%z%n=floor((zmax-zmin)/v%z%d)+1
 img%z%o=zmin
 img%z%d=v%z%d

 if (wbott.ne.0.) then
    call to_history("n1",rec%h%n,"dat");call to_history("d1",rec%h%d,"dat");call to_history("o1",rec%h%o,"dat")
    call to_history("n3",rec%w%n,"dat");call to_history("d3",rec%w%d,"dat");call to_history("o3",rec%w%o,"dat")
    call to_history("n4",rec%x%n,"dat");call to_history("d4",rec%x%d,"dat");call to_history("o4",rec%x%o,"dat")  
    call to_history("n2",1,"dat"); call to_history("d2",1,"dat"); call to_history("o2",1,"dat")
    call to_history("n5",1,"dat"); call to_history("d5",1,"dat"); call to_history("o5",1,"dat")  
    call to_history("esize",8,"dat")
 end if

!----------------------------------------------
!
! Synthesis operator
!

 call to_history("n1",rec%w%n) ; call to_history("d1",rec%w%d) ; call to_history("o1",rec%w%o)
 call to_history("n2",1) ; call to_history("d2",1) ; call to_history("o2",0)
 call to_history("n3",img%xm%n); call to_history("d3",img%xm%d); call to_history("o3",img%xm%o)  
 call to_history("n4",nphi); 	call to_history("d4",dphi); 	call to_history("o4",ophi)
 call to_history("n5",1); call to_history("d5",1); call to_history("o5",1)  
 call to_history("esize",8)

nsh_img=floor(rec%x%d/img%xm%d)*rec%x%n-1+rec%h%n
isp=abs(floor(rec%h%o/rec%h%d)) + 1

if (exist_file("synsh")) then
!----------------------------------------------
!
! Synthesized areal shot
!
 call to_history("n1",rec%w%n,"synsh");	call to_history("d1",rec%w%d,"synsh");	call to_history("o1",rec%w%o,"synsh")
 call to_history("n2",1,"synsh");	call to_history("d2",1,"synsh"); 	call to_history("o2",1,"synsh")
 call to_history("n3",nsh_img,"synsh"); call to_history("d3",rec%h%d,"synsh");	call to_history("o3",rec%x%o+rec%h%o,"synsh")  
 call to_history("n4",nphi,"synsh"); 	call to_history("d4",dphi,"synsh"); 	call to_history("o4",ophi,"synsh")
 call to_history("n5",1,"synsh"); 	call to_history("d5",1,"synsh"); 	call to_history("o5",1,"synsh")  
 call to_history("esize",8,"synsh")
end if

if(exist_file("G1")) then
 call to_history("n1",img%z%n,"G1") ; call to_history("d1",img%z%d,"G1") ; call to_history("o1",img%z%o,"G1")
 call to_history("n2",img%sh%n,"G1"); call to_history("d2",img%sh%d,"G1"); call to_history("o2",img%sh%o,"G1")
 call to_history("n3",img%xm%n,"G1"); call to_history("d3",img%xm%d,"G1"); call to_history("o3",img%xm%o,"G1")  
 call to_history("n4",floor(rec%w%n/10.),"G1"); call to_history("d4",rec%w%d*10,"G1"); call to_history("o4",rec%w%o,"G1")
 call to_history("n5",1,"G1"); call to_history("d5",1,"G1"); call to_history("o5",1,"G1")  
 call to_history("esize",4,"G1")
end if

if(exist_file("wr")) then
 call to_history("n1",rec%w%n,"wr") ; call to_history("d1",rec%w%d,"wr") ; call to_history("o1",rec%w%o,"wr")
 call to_history("n2",img%z%n,"wr"); call to_history("d2",img%z%d,"wr"); call to_history("o2",img%z%o,"wr")
 call to_history("n3",rec%h%n,"wr"); call to_history("d3",rec%h%d,"wr"); call to_history("o3",rec%h%o,"wr")  
 call to_history("n4",1,"wr"); call to_history("d4",1.,"wr"); call to_history("o4",0.,"wr")
 call to_history("n5",1,"wr"); call to_history("d5",1.,"wr"); call to_history("o5",0.,"wr")  
 call to_history("esize",8,"wr")
end if

pi=4*atan(1.)

!--------------------------------------------------
! Frequency vector
! no zero frequency component
!
rec%w%o   = 2*pi * rec%w%o
rec%w%d   = 2*pi * rec%w%d
allocate(rec%w%all(rec%w%n))
do iwb = 1,rec%w%n
   rec%w%all(iwb) = rec%w%o + (iwb - 1) * rec%w%d
end do
!--------------------------------------------------
! Wavenumber vector
!
kxm%n = img%xm%n
kxm%d = 1./(kxm%n* img%xm%d)
kxm%o = 1./(2* img%xm%d)-kxm%d
allocate(kxm%all(kxm%n))
do ikxa=1,kxm%n
   kxm%all(ikxa) = mod(kxm%o+(ikxa-1)*kxm%d,1./ img%xm%d)-kxm%o
end do
kxm%all = 2*pi * kxm%all

write(0,*) "   PARM   "
write(0,*) "=========="
write(0,*) "PARAMETERS"
write(0,*) "=========="
write(0,*) //
write(0,*) "no.ref.velocities   = ",nref
write(0,*) "min.x-coord         = ",xmin
write(0,*) "max.x-coord         = ",xmax
write(0,*) "min.y-coord         = ",ymin
write(0,*) "max.y-coord         = ",ymax
write(0,*) "min.depth           = ",zmin
write(0,*) "max.depth           = ",zmax
write(0,*) "max.limit velocity  = ",vsal
write(0,*) "traces in taper     = ",tapertr
write(0,*) "padded traces       = ",padtraces
write(0,*) "depth of the wavfld = ",depth_wav
write(0,*) "number of wvfld.    = ",nphi
write(0,*) "ang.int.of wvfld.   = ",dphi
write(0,*) "min.ang.of wvfld.   = ",ophi
write(0,*) "phase encoding      = ",encode
write(0,*) //
write(0,*) "============"
write(0,*) "HEADER WORDS"
write(0,*) "============"
write(0,*) //
write(0,*) "SHOTS"
write(0,*) "====="
write(0,*) "number of recv  = ", rec%h%n
write(0,*) "recv spacing    = ", rec%h%d
write(0,*) "min.recv offset = ", rec%h%o
write(0,*) "number of freq  = ", rec%w%n
write(0,*) "freq spacing    = ", rec%w%d/(2*pi)
write(0,*) "minimum freq    = ", rec%w%o/(2*pi)
write(0,*) "number of shots = ", rec%x%n
write(0,*) "shot spacing    = ", rec%x%d
write(0,*) "min.shot-x      = ", rec%x%o
write(0,*) //
write(0,*) "SOURCE FUNCTION"
write(0,*) "==============="
write(0,*) "no.of traces    = ", sou%h%n
write(0,*) "trace spacing   = ", sou%h%d
write(0,*) "min.trace-x     = ", sou%h%o
write(0,*) "number of freq  = ", sou%w%n
write(0,*) "freq spacing    = ", sou%w%d
write(0,*) "minimum freq    = ", sou%w%o
write(0,*) "no.of s.fnct    = ", sou%x%n
write(0,*) "s.fnct spacing  = ", sou%x%d
write(0,*) "min.s.fnct-x    = ", sou%x%o
write(0,*) //
write(0,*) "VELOCITY MODEL"
write(0,*) "=============="
write(0,*) "no.of traces    = ", v%xm%n
write(0,*) "trace spacing   = ", v%xm%d
write(0,*) "min.trace-x     = ", v%xm%o
write(0,*) "no.depth samples= ", v%z%n
write(0,*) "depth interval  = ", v%z%d
write(0,*) "minimum depth   = ", v%z%o
write(0,*) //
write(0,*) "AREAL SPACE"
write(0,*) "==========="
write(0,*) "no.of traces    = ", img%xm%n
write(0,*) "trace spacing   = ", img%xm%d
write(0,*) "min.trace-x     = ", img%xm%o
write(0,*) "no.depth samples= ", img%z%n
write(0,*) "depth interval  = ", img%z%d
write(0,*) "minimum depth   = ", img%z%o
write(0,*) //
write(0,*) "AREAL SHOT"
write(0,*) "=========="
write(0,*) "no.of traces    = ", nsh_img
write(0,*) "trace spacing   = ", img%xm%d
write(0,*) "min.trace-x     = ", img%xm%o
write(0,*) "no.depth samples= ", img%z%n
write(0,*) "depth interval  = ", img%z%d
write(0,*) "minimum depth   = ", img%z%o
write(0,*) //
write(0,*) "WAVENUMBER"
write(0,*) "=========="
write(0,*) "no.wavenumbers  = ", kxm%n
write(0,*) "waveno.spacing  = ", kxm%d
write(0,*) "waveno.origin   = ", kxm%o
write(0,*) //
!write(0,*) kxm%all
end if

end subroutine

end module
