da_xyll.inc
References to this file elsewhere.
1 subroutine da_xyll(proj, xx, yy, 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) :: xx
12 real, intent(in) :: yy
13 real, intent(out) :: lat
14 real, intent(out) :: lon
15
16 real :: x, y
17
18 if (trace_use) call da_trace_entry("da_xyll")
19
20 if (.NOT.proj%init) then
21 call da_error(__FILE__,__LINE__, &
22 (/"You have not called map_set for this projection!"/))
23 end if
24
25 x = xx
26 y = yy
27
28 select case (proj%code)
29 case (PROJ_LATLON)
30 call da_xyll_latlon(x, y, proj, lat, lon)
31
32 case (PROJ_MERC)
33 x = xx - proj%knowni + 1.0
34 y = yy - proj%knownj + 1.0
35 call da_xyll_merc(x, y, proj, lat, lon)
36
37 case (PROJ_PS)
38 call da_xyll_ps(x, y, proj, lat, lon)
39
40 case (PROJ_LC)
41
42 x = xx - proj%knowni + 1.0
43 y = yy - proj%knownj + 1.0
44 call da_xyll_lc(x, y, proj, lat, lon)
45
46 case default
47 write(unit=message(1),fmt='(A,I2)') &
48 "Unrecognized map projection code: ", proj%code
49 call da_error(__FILE__,__LINE__,message(1:1))
50
51 end select
52
53 if (trace_use) call da_trace_exit("da_xyll")
54
55 end subroutine da_xyll
56
57