da_ij_to_latlon.inc

References to this file elsewhere.
1 subroutine da_ij_to_latlon(proj, ii, jj, lat, lon)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: Computes geographical latitude and longitude for a given (i,j) 
5    ! point in a grid with a projection of proj
6    !-----------------------------------------------------------------------
7 
8    implicit none
9 
10    type(proj_info),intent(in)          :: proj
11    real, intent(in)                    :: ii
12    real, intent(in)                    :: jj
13    real, intent(out)                   :: lat
14    real, intent(out)                   :: lon
15    real                                :: i, j
16 
17    if (.NOT.proj%init) then
18       call da_error(__FILE__,__LINE__, &
19          (/"You have not called map_set for this projection!"/))
20    end if
21 
22    i = ii
23    j = jj
24 
25    select case (proj%code)
26       case (PROJ_LATLON)
27          call da_ijll_latlon(i, j, proj, lat, lon)
28 
29       case (PROJ_MERC)
30          i = ii - proj%knowni + 1.0
31          j = jj - proj%knownj + 1.0
32          call da_ijll_merc(i, j, proj, lat, lon)
33 
34       case (PROJ_PS)
35          call da_ijll_ps(i, j, proj, lat, lon)
36 
37       case (PROJ_LC)
38 
39          i = ii - proj%knowni + 1.0
40          j = jj - proj%knownj + 1.0
41          call da_ijll_lc(i, j, proj, lat, lon)
42 
43       case default
44          write(unit=message(1),fmt='(A,I2)') &
45             "Unrecognized map projection code: ", proj%code
46          call da_error(__FILE__,__LINE__,message(1:1))
47 
48    end select
49 
50 end subroutine da_ij_to_latlon
51 
52