1 subroutine da_xyll_ps(x, y, proj, lat, lon)
3 ! This is the inverse subroutine da_of llij_ps. It returns the
4 ! latitude and longitude of an x/y point given the projection info
9 real, intent(in) :: x ! Column
10 real, intent(in) :: y ! Row
11 type (proj_info), intent(in) :: proj
13 real, intent(out) :: lat ! -90 -> 90 North
14 real, intent(out) :: lon ! -180 -> 180 East
22 if (trace_use_frequent) call da_trace_entry("da_xyll_ps")
24 ! Compute the reference longitude by rotating 90 degrees to the east
25 ! to find the longitude line parallel to the positive x-axis.
26 reflon = proj%stdlon + 90.0
28 ! Compute numerator term of map scale factor
29 scale_top = 1.0 + proj%hemi * Sin(proj%truelat1 * rad_per_deg)
31 ! Compute radius to point of interest
33 yy = (y - proj%polej) * proj%hemi
38 lat = proj%hemi * 90.0
41 gi2 = (proj%rebydx * scale_top)**2.0
42 lat = deg_per_rad * proj%hemi * ASin((gi2-r2)/(gi2+r2))
43 arccos = ACOS(xx/sqrt(r2))
45 lon = reflon + deg_per_rad * arccos
47 lon = reflon - deg_per_rad * arccos
51 ! Convert to a -180 -> 180 East convention
52 if (lon > 180.0) lon = lon - 360.0
53 if (lon < -180.0) lon = lon + 360.0
55 if (trace_use_frequent) call da_trace_exit("da_xyll_ps")
57 end subroutine da_xyll_ps