program main
  use base_struct_mod
  use base_ioutil_mod
  use wemva_offdso_mod_new
  implicit none

  type(axis)         :: ax, ay, az
  type(axis)         :: ahx,ahy

  integer            :: stat
  real               :: hcut, hord
  logical            :: adj, add
  character(len=256) :: modl_, data_
 
  call sep_init(SOURCE)
  call getch_add_string("head=/dev/null")
  call getch_add_string("noheader=y")
  call set_no_putch()
  call sep_begin_prog()

  modl_ = "modl"
  data_ = "data"

  call auxinout(modl_)
  call auxinout(data_)

  call from_param("adj" , adj , .false.)
  call from_param("add" , add , .false.)
  call from_param("hcut", hcut, 0.     )
  call from_param("hord", hord, 1.     )

  if (adj) then
     call hinaxis(data_, ahx, 1)
     call hinaxis(data_, ahy, 2)
     call hinaxis(data_, ax , 3)
     call hinaxis(data_, ay , 4)
     call hinaxis(data_, az , 5)
  
     call houaxis(modl_, ahx, 1)
     call houaxis(modl_, ahy, 2)
     call houaxis(modl_, ax , 3)
     call houaxis(modl_, ay , 4)
     call houaxis(modl_, az , 5)
  else
     call hinaxis(modl_, ahx, 1)
     call hinaxis(modl_, ahy, 2)
     call hinaxis(modl_, ax , 3)
     call hinaxis(modl_, ay , 4)
     call hinaxis(modl_, az , 5)

     call houaxis(data_, ahx, 1)
     call houaxis(data_, ahy, 2)
     call houaxis(data_, ax , 3)
     call houaxis(data_, ay , 4)
     call houaxis(data_, az , 5)
  end if

  stat = wemva_offdso_init(ax%n,ay%n,az%n,ahx%n,ahy%n,       &
                          ahx%o,ahy%o,ahx%d,ahy%d,hcut,hord)

  stat = wemva_offdso_oper(adj, add, modl_, data_) 

  stat = wemva_offdso_clos()

end program
