da_togrid.inc

References to this file elsewhere.
1 subroutine da_togrid (x, ib, ie, i, dx, dxm)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: Transfer obs. x to grid i and calculate its
5    ! distance to grid i and i+1
6    !-----------------------------------------------------------------------
7 
8    implicit none
9 
10    real,                     intent(in)  :: x
11    integer,                  intent(in)  :: ib, ie
12    real,                     intent(out) :: dx, dxm
13    integer,                  intent(out) :: i
14 
15    if (trace_use_dull) call da_trace_entry("da_togrid")
16    
17    i = int (x)
18 
19    if (i < ib) then
20       i = ib
21    else if (i >= ie) then
22       i = ie - 1
23    end if
24 
25    dx = x - real(i)
26    dxm= 1.0 - dx
27 
28    if (trace_use_dull) call da_trace_exit("da_togrid")
29 
30 end subroutine da_togrid
31 
32