da_ijll_latlon.inc

References to this file elsewhere.
1 subroutine da_ijll_latlon(i, j, proj, lat, lon)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: Compute the lat/lon location of an i/j on a LATLON grid.
5    !-----------------------------------------------------------------------
6 
7    implicit none
8 
9    real, intent(in)             :: i
10    real, intent(in)             :: j
11    type(proj_info), intent(in)  :: proj
12    real, intent(out)            :: lat
13    real, intent(out)            :: lon
14 
15    real                         :: deltalat
16    real                         :: deltalon
17    real                         :: latinc
18    real                         :: loninc
19 
20    ! Extract the latitude and longitude increments for this grid
21    ! (e.g., 2.5 deg for NCEP reanalysis) from the proj structure, where
22    ! loninc is saved in the stdlon tag and latinc is saved in truelat1
23 
24    latinc = proj%truelat1
25    loninc = proj%stdlon
26 
27    ! Compute deltalat and deltalon 
28 
29    deltalat = (j-1.)*latinc
30    deltalon = (i-1.)*loninc
31    lat = proj%lat1 + deltalat
32    lon = proj%lon1 + deltalon
33 
34    if ((ABS(lat) > 90.0).OR.(ABS(deltalon) > 360.0)) then
35       ! Off the earth for this grid
36       lat = -999.0
37       lon = -999.0
38    else
39       lon = lon + 360.0
40       lon = MOD(lon,360.0)
41       if (lon > 180.0) lon = lon -360.0
42    end if
43 
44 end subroutine da_ijll_latlon
45 
46