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    i = int (x)
16 
17    if (i < ib) then
18       i = ib
19    else if (i >= ie) then
20       i = ie - 1
21    end if
22 
23    dx = x - real(i)
24    dxm= 1.0 - dx
25 
26 end subroutine da_togrid
27 
28