program bmforkma

  use bmproblem, only: iniprob,endprob,setnsv,nobs,obs,obst
  use bmmodel, only: nlambda,complambdaalgencan,checkinglambda

  implicit none

  ! LOCAL SCALARS
  integer :: DayD,DayE
  
  ! LOCAL ARRAYS
  real(kind=8) :: lambda(nlambda)

  call iniprob()

  write(*,*) 'Enter t_today and t_future: '
  read(*,*) DayD,DayE
  
  where ( obst(1:nobs) .le. DayD * 24.0d0 * 3600.0d0 )
     obs(1:nobs) = .true.
  elsewhere
     obs(1:nobs) = .false.
  end where

  write(*,*) 'Observations up to day = ',DayD,' # of observations = ',count( obs(1:nobs) ),' forecast for day = ',DayE
     
  call setnsv(DayE)
     
  lambda(1:nlambda) = 0.0d0

  call complambdaalgencan(nlambda,lambda,1)
  
  call complambdaalgencan(nlambda,lambda,2)

  call checkinglambda(nlambda,lambda,DayE)
        
  call endprob()

  stop

end program bmforkma
