<HTML> <BODY BGCOLOR=#ccccdd LINK=#0000aa VLINK=#0000ff ALINK=#ff0000 ><BASE TARGET="bottom_target"><PRE>
<A NAME='DA_TOGRID'><A href='../../html_code/tools/da_togrid.inc.html#DA_TOGRID' TARGET='top_target'><IMG SRC="../../gif/bar_red.gif" border=0></A>
subroutine da_togrid (x, ib, ie, i, dx, dxm) 6,2
!-----------------------------------------------------------------------
! Purpose: Transfer obs. x to grid i and calculate its
! distance to grid i and i+1
!-----------------------------------------------------------------------
implicit none
real, intent(in) :: x
integer, intent(in) :: ib, ie
real, intent(out) :: dx, dxm
integer, intent(out) :: i
if (trace_use_dull) call da_trace_entry
("da_togrid")
i = int (x)
if (i < ib) then
i = ib
else if (i >= ie) then
i = ie - 1
end if
dx = x - real(i)
dxm= 1.0 - dx
if (trace_use_dull) call da_trace_exit
("da_togrid")
end subroutine da_togrid