module OW_sltpar

use sep
use OW_type

implicit none

type (axis) ,public, save					:: xm, z, sh
type (mod_grid) ,public, save					:: sog
integer, public, save					:: nxw,nyw,nzw,nodes
integer, public, save					:: nax,nay
real, public, save						:: dax,day,oax,oay,eps
integer, public, save					:: nahx,nahy,nz,xchunk,xremain,nxchunk
real, public, save						:: dahx,dahy,oahy,oahx,zmin,zmax,wexp,yexp
logical, public, save					:: rot,rec

contains

subroutine owsltpar()

  call from_history("n1",sog%z%n);  call from_history("d1",sog%z%d);  call from_history("o1",sog%z%o)
  call from_history("n2",sog%shx%n);call from_history("d2",sog%shx%d);call from_history("o2",sog%shx%o)
  call from_history("n3",sog%xm%n); call from_history("d3",sog%xm%d); call from_history("o3",sog%xm%o)  
  call from_history("n4",sog%shy%n);call from_history("d4",sog%shy%d);call from_history("o4",sog%shy%o)
  call from_history("n5",sog%ym%n); call from_history("d5",sog%ym%d); call from_history("o5",sog%ym%o)  
  write(0,*) "============================================"
  write(0,1) " n1 = ",sog%z%n, "    d1 = ",sog%z%d, "   o1 = ",sog%z%o
  write(0,1) " n2 = ",sog%shx%n,"    d2 = ",sog%shx%d,"   o2 = ",sog%shx%o
  write(0,1) " n3 = ",sog%xm%n,  "    d3 = ",sog%xm%d,  "   o3 = ",sog%xm%o
  write(0,1) " n4 = ",sog%shy%n,"    d4 = ",sog%shy%d,"   o4 = ",sog%shy%o
  write(0,1) " n5 = ",sog%ym%n, "    d5 = ",sog%ym%d, "   o5 = ",sog%ym%o
  write(0,*) "============================================"
1 format(a6,i5,2(a9,f10.4))
!!  get parameters
  call from_param("nxw",nxw,7)
  call from_param("nyw",nyw,7)
  call from_param("nzw",nzw,35)
  call from_param("dax",dax,1.)
  call from_param("oax",oax,-20.)
  call from_param("nax",nax,int(2*(-oax)/dax+1))
  call from_param("dahx",dahx,1.)
  call from_param("oahx",oahx,-40.)
  call from_param("nahx",nahx,int(2*(-oahx)/dahx+1))
  call from_param("day",day,1.)
  call from_param("oay",oay,-20.)
  call from_param("nay",nay,int(2*(-oay)/day+1))
  call from_param("dahy",dahy,1.)
  call from_param("oahy",oahy,-40.)
  call from_param("nahy",nahy,int(2*(-oahy)/dahy+1))
  call from_param("zmin",zmin,sog%z%o)
  call from_param("zmax",zmax,(sog%z%n-1)*sog%z%d+sog%z%o)
!  nzmin=zmin/sog%z%d+1
!  nzmax=zmax/sog%z%d+1
  nz=(zmax-zmin)/sog%z%d+1.5
  call from_param("nodes",nodes)
  call from_param("eps",eps,1.)
  call from_param("wexp",wexp,0.25)
  call from_param("yexp",yexp,0.25)
  call from_param("rot",rot,.false.)
  call from_param("rec",rec,.false.)

  write(0,*) "==============================================="
  write(0,2) " nax = ",nax,"    dax = ",dax,"   oax = ",oax
  write(0,2) " nay = ",nay,"    day = ",day,"   oay = ",oay
  write(0,2) " nhx = ",nahx,"    dhx = ",dahx,"   ohx = ",oahx
  write(0,2) " nhy = ",nahy,"    dhy = ",dahy,"   ohy = ",oahy
  write(0,*) "==============================================="
  write(0,*) " rec = ",rec
2 format(a7,i5,2(a10,f8.3))

!! set up output file 
     call to_history("n1",sog%z%n);call to_history("d1",sog%z%d);call to_history("o1",sog%z%o)
     call to_history("n2",sog%shx%n);call to_history("d2",sog%shx%d);call to_history("o2",sog%shx%o)
     call to_history("n3",sog%xm%n);call to_history("d3",sog%xm%d);call to_history("o3",sog%xm%o)  
     call to_history("n4",sog%shy%n);call to_history("d4",sog%shy%d);call to_history("o4",sog%shy%o)
     call to_history("n5",sog%ym%n);call to_history("d5",sog%ym%d);call to_history("o5",sog%ym%o)  
     call to_history("label1","z")
     call to_history("label2","hx")
     call to_history("label3","x")
     call to_history("label4","hy")
     call to_history("label5","y")
     call to_history("esize",4)

end subroutine

end module
