1 subroutine da_llxy (info, loc, outside, outside_all)
3 !-----------------------------------------------------------------------
5 ! Updated for Analysis on Arakawa-C grid
6 ! Author: Syed RH Rizvi, MMM/ESSL/NCAR, Date: 10/22/2008
7 !-----------------------------------------------------------------------
9 ! This routine converts (lat, lon) into (x,y) coordinates
13 type(info_type), intent(in) :: info
14 type(model_loc_type), intent(inout) :: loc
15 logical , intent(out) :: outside !wrt local domain
16 logical, optional, intent(out) :: outside_all !wrt all domains
18 ! too many return statments to trace
19 ! if (trace_use_frequent) call da_trace_entry("da_llxy")
25 ! get the (x, y) coordinates
27 if ( fg_format == fg_format_wrf_arw_regional ) then
28 call da_llxy_wrf(map_info, info%lat, info%lon, loc%x, loc%y)
29 else if (fg_format == fg_format_wrf_nmm_regional) then
30 call da_llxy_rotated_latlon(info%lat, info%lon, map_info, loc%x, loc%y)
32 call da_llxy_global (info%lat, info%lon, loc%x, loc%y)
34 call da_llxy_default (info%lat, info%lon, loc%x, loc%y)
38 call da_togrid (loc%x, its-3, ite+3, loc%i, loc%dx, loc%dxm)!
40 call da_togrid (loc%y, jts-3, jte+3, loc%j, loc%dy, loc%dym)
42 call da_togrid (loc%x, its-2, ite+2, loc%i, loc%dx, loc%dxm)!
44 call da_togrid (loc%y, jts-2, jte+2, loc%j, loc%dy, loc%dym)
47 ! refactor to remove this ugly duplication later
48 if (present(outside_all)) then
50 ! Do not check for global options
51 if (.not. global) then
52 if ((int(loc%x) < ids) .or. (int(loc%x) > ide) .or. &
53 (int(loc%y) < jds) .or. (int(loc%y) > jde)) then
58 if (def_sub_domain) then
59 if (x_start_sub_domain > loc%x .or. y_start_sub_domain > loc%y .or. &
60 x_end_sub_domain < loc%x .or. y_end_sub_domain < loc%y) then
69 if (fg_format == fg_format_kma_global) then
70 if ((loc%j < jts-1) .or. (loc%j > jte)) then
75 if (loc%j == jde) then
84 ! Check for edge of domain:
86 if ((loc%i < ids) .or. (loc%i >= ide) .or. &
87 (loc%j < jds) .or. (loc%j >= jde)) then
94 !rizviupdt if ((loc%i < its-1) .or. (loc%i > ite) .or. &
95 !rizviupdt (loc%j < jts-1) .or. (loc%j > jte)) then
96 if ((loc%i < its-2) .or. (loc%i > ite) .or. &
97 (loc%j < jts-2) .or. (loc%j > jte)) then
99 if ((loc%i < its-1) .or. (loc%i > ite) .or. &
100 (loc%j < jts-1) .or. (loc%j > jte)) then
102 ! if ((loc%i < its-1) .or. (loc%i >= ite) .or. &
103 ! (loc%j < jts-1) .or. (loc%j >= jte)) then
107 if (def_sub_domain) then
108 if (x_start_sub_domain > loc%x .or. y_start_sub_domain > loc%y .or. &
109 x_end_sub_domain < loc%x .or. y_end_sub_domain < loc%y) then
115 ! if (trace_use_frequent) call da_trace_exit("da_llxy")
117 end subroutine da_llxy