da_get_innov_vector_profiler.inc

References to this file elsewhere.
1 subroutine da_get_innov_vector_profiler( it, xb, xp, ob, iv)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    ! Update :
6    !     01/24/2007    Syed RH Rizvi
7    !     Updated for "VERIFY"       
8    !-----------------------------------------------------------------------
9 
10    implicit none
11 
12    integer, intent(in)            :: it       ! External iteration.
13    type(xb_type), intent(in)     :: xb       ! first guess state.
14    type(xpose_type), intent(in)  :: xp       ! Domain decomposition vars.
15    type(y_type),  intent(inout)  :: ob       ! Observation structure.
16    type(ob_type), intent(inout)  :: iv       ! O-B structure.
17 
18    integer                        :: n        ! Loop counter.
19    integer                        :: i, j, k  ! Index dimension.
20    integer                        :: num_levs ! Number of obs levels.
21 
22    real                           :: dx, dxm  ! Interpolation weights.
23    real                           :: dy, dym  ! Interpolation weights.
24 
25    real, dimension(1:max_ob_levels) :: model_u  ! Model value u at ob location.
26    real, dimension(1:max_ob_levels) :: model_v  ! Model value v at ob location.
27 
28    real, dimension(xp%kms:xp%kme) :: v_p      ! Model value p at ob hor. location.
29    integer           :: itu,ituf,itvv,itvvf
30 
31    if (iv % num_profiler > 0) then
32       itu   = 0; itvv    = 0;
33       ituf  = 0; itvvf   = 0;
34 
35       do n=iv%ob_numb(iv%current_ob_time-1)%profiler + 1, &
36          iv%ob_numb(iv%current_ob_time)%profiler
37 
38          num_levs = iv % profiler(n) % info % levels
39 
40          if (num_levs < 1) cycle
41 
42          model_u(:) = 0.0
43          model_v(:) = 0.0
44 
45          ! [1.3] Get horizontal interpolation weights:
46 
47          i = iv%profiler(n)%loc%i
48          j = iv%profiler(n)%loc%j
49          dx = iv%profiler(n)%loc%dx
50          dy = iv%profiler(n)%loc%dy
51          dxm = iv%profiler(n)%loc%dxm
52          dym = iv%profiler(n)%loc%dym
53 
54          do k=xp%kts,xp%kte
55             v_p(k) = dym*(dxm*xb%p(i,j  ,k) + dx*xb%p(i+1,j  ,k)) &
56                    + dy *(dxm*xb%p(i,j+1,k) + dx*xb%p(i+1,j+1,k))
57          end do
58 
59          do k=1, iv % profiler(n) % info % levels
60             iv%profiler(n)%zk(k)=missing_r
61 
62             if (iv % profiler(n) % p(k) > 1.0) then
63                call da_to_zk(iv % profiler(n) % p(k), v_p, xp, v_interp_p, iv%profiler(n)%zk(k))
64             end if
65 
66             if (iv%profiler(n)%zk(k) < 0.0 .and.  .not.anal_type_verify) then
67                iv % profiler(n) % u(k) % qc = missing
68                iv % profiler(n) % v(k) % qc = missing
69             end if
70          end do
71 
72          ! [1.4] Interpolate horizontally:
73          call da_interp_lin_3d( xb % u, xp, i, j, dx, dy, dxm, dym, &
74             model_u, max_ob_levels, iv%profiler(n)%zk, num_levs)
75          call da_interp_lin_3d( xb % v, xp, i, j, dx, dy, dxm, dym, &
76             model_v, max_ob_levels, iv%profiler(n)%zk, num_levs)
77 
78          !------------------------------------------------------------------------
79          ! [2.0] Initialise components of innovation vector:
80          !------------------------------------------------------------------------
81 
82          do k = 1, iv % profiler(n) % info % levels
83             iv % profiler(n) % u(k) % inv = 0.0
84             iv % profiler(n) % v(k) % inv = 0.0
85 
86             !----------------------------------------------------------------
87             ! [4.0] Fast interpolation:
88             !----------------------------------------------------------------
89 
90             if (ob % profiler(n) % u(k) > missing_r .AND. &
91                  iv % profiler(n) % u(k) % qc >= obs_qc_pointer) then
92 
93                iv % profiler(n) % u(k) % inv = ob % profiler(n) % u(k) - &
94                                               model_u(k)
95             end if
96 
97             if (ob % profiler(n) % v(k) > missing_r .AND. &
98                  iv % profiler(n) % v(k) % qc >= obs_qc_pointer) then
99 
100                iv % profiler(n) % v(k) % inv = ob % profiler(n) % v(k) - &
101                                               model_v(k)
102             end if
103          end do
104 
105          !------------------------------------------------------------------
106          ! [5.0] Perform optional maximum error check:
107          !------------------------------------------------------------------
108 
109          if (check_max_iv) then  
110             call da_check_max_iv_profiler(it, iv % profiler(n), &
111                itu,ituf,itvv,itvvf)
112          end if
113       end do
114 
115       if (rootproc .and. check_max_iv_print) then
116          write(unit = check_max_iv_unit, fmt ='(A,i5,A)')&
117             'For outer iteration ',it, ', Total Rejections for Profiler follows:'
118          write(unit = check_max_iv_unit, fmt = '(/,10(2(A,I6),/))') &
119             'Number of failed u-wind observations:     ',ituf, ' on ',itu,   &
120             'Number of failed v-wind observations:     ',itvvf,' on ',itvv,  &
121             'Finally Total Profiler rejections ',ituf+itvvf,' on ',itu +itvv
122       end if
123    end if
124 
125 end subroutine da_get_innov_vector_profiler
126 
127