da_transform_xtoy_metar.inc

References to this file elsewhere.
1 subroutine da_transform_xtoy_metar (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 (trace_use) call da_trace_entry("da_transform_xtoy_metar")
21 
22    if (iv%num_metar > 0) then
23 
24       !xyh      y%metar(:)%u = 0.0
25       !xyh      y%metar(:)%v = 0.0
26       !xyh      y%metar(:)%t = 0.0
27       !xyh      y%metar(:)%p = 0.0
28       !xyh      y%metar(:)%q = 0.0
29 
30       if (sfc_assi_options == 1) then
31          do n=iv%ob_numb(iv%current_ob_time-1)%metar + 1, iv%ob_numb(iv%current_ob_time)%metar
32 
33             ! [1.1] Get horizontal interpolation weights:
34 
35             i = iv%metar(n)%loc%i
36             dy = iv%metar(n)%loc%dy
37             dym = iv%metar(n)%loc%dym
38             j = iv%metar(n)%loc%j
39             dx = iv%metar(n)%loc%dx
40             dxm = iv%metar(n)%loc%dxm
41 
42             ! [1.2] Interpolate horizontally:
43             call da_interp_obs_lin_2d(xa % u, xp, i, j, dx, dy, dxm, dym, &
44                                    y%metar(n)%u, iv%metar(n)%zk)
45             call da_interp_obs_lin_2d(xa % v, xp, i, j, dx, dy, dxm, dym, &
46                                    y%metar(n)%v, iv%metar(n)%zk)
47             call da_interp_obs_lin_2d(xa % t, xp, i, j, dx, dy, dxm, dym, &
48                                    y%metar(n)%t, iv%metar(n)%zk)
49             call da_interp_obs_lin_2d(xa % q, xp, i, j, dx, dy, dxm, dym, &
50                                    y%metar(n)%q, iv%metar(n)%zk)
51 
52             call da_interp_lin_2d(xa % psfc, xp%ims, xp%ime, xp%jms, xp%jme, &
53                                i, j, dx, dy, dxm, dym, y%metar(n)%p)
54          end do
55       else if (sfc_assi_options == 2) then
56          ! [2.0] Surface assimilation approach 2
57          do n=iv%ob_numb(iv%current_ob_time-1)%metar + 1, iv%ob_numb(iv%current_ob_time)%metar
58             call da_transform_xtopsfc(xb,xa,xp,iv%metar(n),y%metar(n))
59          end do
60       end if
61    end if
62 
63    if (trace_use) call da_trace_exit("da_transform_xtoy_metar")
64 
65 end subroutine da_transform_xtoy_metar
66 
67