1 subroutine da_transform_xtoy_sonde_sfc_adj(grid, iv, jo_grad_y, jo_grad_x)
3 !-----------------------------------------------------------------------
5 ! Updated for Analysis on Arakawa-C grid
6 ! Author: Syed RH Rizvi, MMM/ESSL/NCAR, Date: 10/22/2008
7 !-----------------------------------------------------------------------
11 type (domain), intent(in) :: grid
12 type (iv_type), intent(in) :: iv ! obs. inc vector (o-b).
13 type (y_type) , intent(inout) :: jo_grad_y ! grad_y(jo)
14 type (x_type) , intent(inout) :: jo_grad_x ! grad_x(jo)
16 integer :: n ! Loop counter.
18 real, allocatable :: model_u(:,:)
19 real, allocatable :: model_v(:,:)
20 real, allocatable :: model_t(:,:)
21 real, allocatable :: model_q(:,:)
22 real, allocatable :: model_psfc(:)
24 real, allocatable :: ub(:,:)
25 real, allocatable :: vb(:,:)
27 if (trace_use_dull) call da_trace_entry("da_transform_xtoy_sonde_sfc_adj")
29 if (sfc_assi_options == sfc_assi_options_1) then
31 allocate (model_u(1,iv%info(sound)%n1:iv%info(sound)%n2))
32 allocate (model_v(1,iv%info(sound)%n1:iv%info(sound)%n2))
33 allocate (model_t(1,iv%info(sound)%n1:iv%info(sound)%n2))
34 allocate (model_q(1,iv%info(sound)%n1:iv%info(sound)%n2))
35 allocate (model_psfc(iv%info(sound)%n1:iv%info(sound)%n2))
37 allocate (ub(1,iv%info(sound)%n1:iv%info(sound)%n2))
38 allocate (vb(1,iv%info(sound)%n1:iv%info(sound)%n2))
40 call da_interp_lin_3d (grid%xb%u, iv%info(sonde_sfc), ub)
41 call da_interp_lin_3d (grid%xb%v, iv%info(sonde_sfc), vb)
43 ! [1.2] Interpolate horizontally:
44 do n=iv%info(sound)%n1,iv%info(sound)%n2
46 call da_uv_to_sd_adj(jo_grad_y%sonde_sfc(n)%u, &
47 jo_grad_y%sonde_sfc(n)%v, model_u(1,n), model_v(1,n), ub(1,n), vb(1,n))
49 model_u(1,n) = jo_grad_y%sonde_sfc(n)%u
50 model_v(1,n) = jo_grad_y%sonde_sfc(n)%v
52 model_t(1,n) = jo_grad_y%sonde_sfc(n)%t
53 model_q(1,n) = jo_grad_y%sonde_sfc(n)%q
54 model_psfc(n) = jo_grad_y%sonde_sfc(n)%p
58 call da_interp_lin_3d_adj (jo_grad_x%u, iv%info(sonde_sfc), model_u,'u')
59 call da_interp_lin_3d_adj (jo_grad_x%v, iv%info(sonde_sfc), model_v,'v')
61 call da_interp_lin_3d_adj (jo_grad_x%u, iv%info(sonde_sfc), model_u)
62 call da_interp_lin_3d_adj (jo_grad_x%v, iv%info(sonde_sfc), model_v)
64 call da_interp_lin_3d_adj (jo_grad_x%t, iv%info(sonde_sfc), model_t)
65 call da_interp_lin_3d_adj (jo_grad_x%q, iv%info(sonde_sfc), model_q)
67 call da_interp_lin_2d_adj (jo_grad_x%psfc, iv%info(sonde_sfc), 1, model_psfc)
72 deallocate (model_psfc)
76 else if (sfc_assi_options == sfc_assi_options_2) then
77 call da_transform_xtopsfc_adj(grid,iv,sonde_sfc,iv%sonde_sfc(:), jo_grad_y%sonde_sfc(:),jo_grad_x)
80 if (trace_use_dull) call da_trace_exit("da_transform_xtoy_sonde_sfc_adj")
82 end subroutine da_transform_xtoy_sonde_sfc_adj