program model_covar
use  sep
use sep3d_struct_mod
use basic_util_mod
use model_covar_mod
use io_nfilt
implicit none
integer :: ns(3),nfilt
real    :: os(3),ds(3)
type(sep3d) :: struct
type(nfilter) :: filt1,filt2
character(len=128) :: method

call sep_init(SOURCE)
call from_param("method",method,"steer")
call init_sep3d("in",struct,"INPUT")
call set_n_o_d_3d(struct,ns,os,ds)

if(.not. init_model_covar(struct,method)) &
  call seperr("trouble initializing model covariance")

write(0,*) "DEATH 1"
if(.not. build_model_covar(filt1,filt2,nfilt)) &
  call seperr("trouble building model covariance")
write(0,*) "DEATH 2"


if(.not. rite_nfilt("out",filt1,ns,os,ds)) call seperr( "trouble writing out filt1")
call ndeallocate(filt1)
if(nfilt==2) then
  if(.not. rite_nfilt("filt2",filt2,ns,os,ds)) call seperr("trouble writing out filt2")
  call ndeallocate(filt2)
end if

end program
