da_transform_xtoy_sonde_sfc.inc

References to this file elsewhere.
1 subroutine da_transform_xtoy_sonde_sfc (xa, xb, iv, xp, y)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6 
7    implicit none
8 
9    type (x_type),     intent(inoUT) :: xa       ! gridded analysis increment.
10    type (xb_type),    intent(in)    :: xb       ! first guess state.
11    type (ob_type),    intent(in)    :: iv       ! Innovation vector (O-B).
12    type (xpose_type), intent(in)    :: xp       ! Domain decomposition vars.
13    type (y_type),     intent(inout) :: y        ! y = h (xa) (linear)
14 
15    integer                      :: n        ! Loop counter.
16    integer                      :: i, j     ! Index dimension.
17    real                         :: dx, dxm  ! 
18    real                         :: dy, dym  !
19 
20    if (iv%num_sound > 0) then
21       ! xyh
22       ! y%sonde_sfc(:)%u = 0.0
23       ! y%sonde_sfc(:)%v = 0.0
24       ! y%sonde_sfc(:)%t = 0.0
25       ! y%sonde_sfc(:)%p = 0.0
26       ! y%sonde_sfc(:)%q = 0.0
27 
28       if (sfc_assi_options == 1) then
29          do n=iv%ob_numb(iv%current_ob_time-1)%sound + 1, iv%ob_numb(iv%current_ob_time)%sound
30 
31             ! [1.1] Get horizontal interpolation weights:
32 
33             i = iv%sonde_sfc(n)%loc%i
34             j = iv%sonde_sfc(n)%loc%j
35             dx = iv%sonde_sfc(n)%loc%dx
36             dy = iv%sonde_sfc(n)%loc%dy
37             dxm = iv%sonde_sfc(n)%loc%dxm
38             dym = iv%sonde_sfc(n)%loc%dym
39 
40             ! [1.2] Interpolate horizontally:
41             call da_interp_obs_lin_2d(xa % u, xp, i, j, dx, dy, dxm, dym, &
42                                    y%sonde_sfc(n)%u, iv%sonde_sfc(n)%zk)
43             call da_interp_obs_lin_2d(xa % v, xp, i, j, dx, dy, dxm, dym, &
44                                    y%sonde_sfc(n)%v, iv%sonde_sfc(n)%zk)
45             call da_interp_obs_lin_2d(xa % t, xp, i, j, dx, dy, dxm, dym, &
46                                    y%sonde_sfc(n)%t, iv%sonde_sfc(n)%zk)
47             call da_interp_obs_lin_2d(xa % q, xp, i, j, dx, dy, dxm, dym, &
48                                    y%sonde_sfc(n)%q, iv%sonde_sfc(n)%zk)
49 
50             call da_interp_lin_2d(xa % psfc, xp%ims, xp%ime, xp%jms, xp%jme, &
51                                i, j, dx, dy, dxm, dym, y%sonde_sfc(n)%p)
52          end do
53       else if (sfc_assi_options == 2) then
54          do n=iv%ob_numb(iv%current_ob_time-1)%sound + 1, iv%ob_numb(iv%current_ob_time)%sound
55             call da_transform_xtopsfc(xb, xa, xp, iv%sonde_sfc(n), y%sonde_sfc(n))
56          end do
57      end if
58   end if
59 
60 end subroutine da_transform_xtoy_sonde_sfc
61 
62