1 subroutine da_llxy_default_new (info)
3 !----------------------------------------------------------------------------
9 ! Purpose: calculates the (x,y) location (dot) in the mesoscale grids
10 ! ------- from latitudes and longitudes
12 ! for global domain co-ordinates
21 ! x: the coordinate in x (i)-direction.
22 ! y: the coordinate in y (j)-direction.
24 !----------------------------------------------------------------------------
28 type(infa_type), intent(inout) :: info
32 real :: xx, yy, xc, yc
33 real :: cell, psi0, psx, r, flp
34 real :: centri, centrj
37 real, parameter :: conv = 180.0 / pi
41 if (trace_use) call da_trace_entry("da_llxy_default_new")
43 ! Slow, but I can't be arsed to do all the temporary arrays
45 do n=1,ubound(info%lat,2)
49 xlat = max (xlat, -89.95)
50 xlat = min (xlat, +89.95)
53 if (dxlon > 180) dxlon = dxlon - 360.0
54 if (dxlon < -180) dxlon = dxlon + 360.0
56 if (map_projection == 3) then
60 cell = cos(xlat/conv)/(1.0+sin(xlat/conv))
64 psi0 = (pole - phic)/conv
67 ! calculate x,y coords. relative to pole
69 flp = cone_factor*dxlon/conv
71 psx = (pole - xlat)/conv
73 if (map_projection == 2) then
74 ! Polar stereographics:
75 bb = 2.0*(cos(psi1/2.0)**2)
76 yc = -earth_radius*bb*tan(psi0/2.0)
77 r = -earth_radius*bb*tan(psx/2.0)
80 bb = -earth_radius/cone_factor*sin(psi1)
81 yc = bb*(tan(psi0/2.0)/tan(psi1/2.0))**cone_factor
82 r = bb*(tan(psx /2.0)/tan(psi1/2.0))**cone_factor
95 ! transform (1,1) to the origin
96 ! the location of the center in the coarse domain
98 centri = real (coarse_ix + 1)/2.0
99 centrj = real (coarse_jy + 1)/2.0
101 ! the (x,y) coordinates in the coarse domain
103 info%x(1,n) = (xx - xc)/coarse_ds + centri
104 info%y(1,n) = (yy - yc)/coarse_ds + centrj
106 ratio = coarse_ds / dsm
108 ! only add 0.5 so that x/y is relative to first cross points:
110 info%x(:,n) = (info%x(1,n) - start_x)*ratio + 0.5
111 info%y(:,n) = (info%y(1,n) - start_y)*ratio + 0.5
114 if (trace_use) call da_trace_exit("da_llxy_default_new")
116 end subroutine da_llxy_default_new