1 subroutine da_transform_xtoy_gpseph (iv, y)
3 !-------------------------------------------------------------------------
4 ! Purpose: y = H(grid%xa)
5 !-------------------------------------------------------------------------
9 type (iv_type), intent(in) :: iv ! Innovation vector (O-B).
10 type (y_type), intent(inout) :: y ! y = h (grid%xa)
12 integer :: is, ie, js, je, ks, ke
13 real, dimension(kds:kde) :: mean_h ! mean altitude in each level
14 real, dimension(kds:kde) :: mdl_z
15 real, dimension(kds:kde) :: mdl_ref, mdl_ref9
16 real, dimension(kds:kde) :: refm, refm9
17 real, dimension(3,kds:kde) :: cc, cc9
18 real, dimension(ids:ide,jds:jde,kds:kde) :: ref_mean_h_tl
19 integer :: i, j, k, l, m, n, i1, i2, i3, nbot, ntop, nk, nn
20 real :: step, h, tmp_ref
21 real,dimension(2) :: w1
22 real,dimension(2,2) :: w2
23 integer :: ip1,ip2,ip3,je2
26 if (trace_use_dull) call da_trace_entry("da_transform_xtoy_gpseph")
36 step = gps_ray_path_step
37 mean_h(:) = global_h_mean(:) !km
39 ! calculate ref increment on mean_h from ref increment on model grid
43 mdl_z(kds:kde) = global_h(i,j,kds:kde)
44 mdl_ref(kds:kde) = global_xa_ref(i,j,kds:kde)*(1./global_ref(i,j,kds:kde))
45 mdl_ref9(kds:kde) = log(global_ref(i,j,kds:kde))
47 call da_splinx_lin(nk,mdl_z,mdl_ref9,mdl_ref,cc9,cc,nk,mean_h*1000.,refm9,refm)
49 ref_mean_h_tl(i,j,kds:kde) = refm(kds:kde)*exp(refm9(kds:kde))
54 do n=iv%info(gpseph)%n1,iv%info(gpseph)%n2
56 nbot = gps_rays(n)%nbot
57 ntop = gps_rays(n)%ntop
58 if ( nbot == 0 .and. ntop == 0 ) cycle
61 if ( iv%gpseph(n)%eph(i)%qc < obs_qc_pointer ) cycle
62 y%gpseph(n)%eph(i)=0.0
64 if ( gps_rays(n)%ilocal(i)==1 ) then
66 je2 = gps_rays(n)%je2(i)
69 h = gps_rays(n)%ip123(i)%h(k*j)
70 if ( h <= mean_h(ke-1) ) then
71 i1 = gps_rays(n)%ip123(i)%i1(k*j)
72 i2 = gps_rays(n)%ip123(i)%i2(k*j)
73 i3 = gps_rays(n)%ip123(i)%i3(k*j)
74 w1 = gps_rays(n)%ip123(i)%w1(1:2,k*j)
75 w2 = gps_rays(n)%ip123(i)%w2(1:2,1:2,k*j)
80 tmp_ref=tmp_ref+ref_mean_h_tl(i1+l-1,i2+m-1,i3+nn-1)*w2(l,m)*w1(nn)
84 y%gpseph(n)%eph(i)=y%gpseph(n)%eph(i)+step*tmp_ref
89 else if ( gps_rays(n)%ilocal(i)==0 ) then
91 ip1 = gps_rays(n)%ip123(i)%i1(0)
92 ip2 = gps_rays(n)%ip123(i)%i2(0)
93 ip3 = gps_rays(n)%ip123(i)%i3(0)
94 w1 = gps_rays(n)%ip123(i)%w1(1:2,0)
95 w2 = gps_rays(n)%ip123(i)%w2(1:2,1:2,0)
101 refp=refp+ref_mean_h_tl(ip1+l-1,ip2+m-1,ip3+nn-1)*w2(l,m)*w1(nn)
105 y%gpseph(n)%eph(i)=step*refp
109 end do !nbot-ntop loop
112 if (trace_use_dull) call da_trace_exit("da_transform_xtoy_gpseph")
114 end subroutine da_transform_xtoy_gpseph