da_transform_xtoy_metar.inc

References to this file elsewhere.
1 subroutine da_transform_xtoy_metar (grid, iv, y)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6 
7    implicit none
8 
9    type (domain),  intent(inout) :: grid
10    type (iv_type), intent(in)    :: iv       ! Innovation vector (O-B).
11    type (y_type),  intent(inout) :: y        ! y = h (grid%xa) (linear)
12 
13    integer                      :: n   ! Loop counter.
14 
15    real, allocatable :: model_u(:,:)
16    real, allocatable :: model_v(:,:)
17    real, allocatable :: model_t(:,:)
18    real, allocatable :: model_q(:,:)
19    real, allocatable :: model_p(:)
20 
21    if (trace_use_dull) call da_trace_entry("da_transform_xtoy_metar")
22 
23    if (sfc_assi_options == sfc_assi_options_1) then
24       allocate (model_u(1,iv%info(metar)%n1:iv%info(metar)%n2))
25       allocate (model_v(1,iv%info(metar)%n1:iv%info(metar)%n2))
26       allocate (model_t(1,iv%info(metar)%n1:iv%info(metar)%n2))
27       allocate (model_q(1,iv%info(metar)%n1:iv%info(metar)%n2))
28       allocate (model_p(iv%info(metar)%n1:iv%info(metar)%n2))
29       ! [1.2] Interpolate horizontally:
30       call da_interp_lin_3d (grid%xa%u, iv%info(metar),model_u)
31       call da_interp_lin_3d (grid%xa%v, iv%info(metar),model_v)
32       call da_interp_lin_3d (grid%xa%t, iv%info(metar),model_t)
33       call da_interp_lin_3d (grid%xa%q, iv%info(metar),model_q)
34 
35       call da_interp_lin_2d (grid%xa%psfc, iv%info(metar), 1, model_p)
36 
37       do n=iv%info(metar)%n1,iv%info(metar)%n2
38          y%metar(n)%u = model_u(1,n)
39          y%metar(n)%v = model_v(1,n)
40          y%metar(n)%t = model_t(1,n)
41          y%metar(n)%q = model_q(1,n)
42          y%metar(n)%p = model_p(n)
43       end do
44       deallocate (model_u)
45       deallocate (model_v)
46       deallocate (model_t)
47       deallocate (model_q)
48       deallocate (model_p)
49    else if (sfc_assi_options == sfc_assi_options_2) then
50       ! [2.0] Surface assmiilation approach 2
51       call da_transform_xtopsfc(grid,iv,metar,iv%metar(:),y%metar(:))
52    end if
53 
54    if (trace_use_dull) call da_trace_exit("da_transform_xtoy_metar")
55 
56 end subroutine da_transform_xtoy_metar
57 
58