da_get_innov_vector_pilot.inc
References to this file elsewhere.
1 subroutine da_get_innov_vector_pilot( 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
30 integer :: itu,ituf,itvv,itvvf
31
32 if (iv % num_pilot < 1) return
33
34 if (trace_use) call da_trace_entry("da_get_innov_vector_pilot")
35
36 itu = 0
37 itvv = 0
38 ituf = 0
39 itvvf = 0
40
41 do n=iv%ob_numb(iv%current_ob_time-1)%pilot + 1, iv%ob_numb(iv%current_ob_time)%pilot
42
43 num_levs = iv % pilot(n) % info % levels
44
45 if (num_levs < 1) cycle
46
47 model_u(:) = 0.0
48 model_v(:) = 0.0
49
50 ! [1.3] Get horizontal interpolation weights:
51
52 i = iv%pilot(n)%loc%i
53 j = iv%pilot(n)%loc%j
54 dx = iv%pilot(n)%loc%dx
55 dy = iv%pilot(n)%loc%dy
56 dxm = iv%pilot(n)%loc%dxm
57 dym = iv%pilot(n)%loc%dym
58
59 do k=xp%kts,xp%kte
60 v_p(k) = dym*(dxm*xb%p(i,j ,k) + dx*xb%p(i+1,j ,k)) &
61 + dy *(dxm*xb%p(i,j+1,k) + dx*xb%p(i+1,j+1,k))
62 end do
63
64 do k=1, iv % pilot(n) % info % levels
65 iv%pilot(n)%zk(k)=missing_r
66
67 if (iv % pilot(n) % p(k) > 1.0) then
68 call da_to_zk(iv % pilot(n) % p(k), v_p, xp, v_interp_p, iv%pilot(n)%zk(k))
69 end if
70
71 if (iv%pilot(n)%zk(k) < 0.0 .and. .not.anal_type_verify) then
72 iv % pilot(n) % u(k) % qc = missing
73 iv % pilot(n) % v(k) % qc = missing
74 end if
75 end do
76
77 ! [1.4] Interpolate horizontally:
78 call da_interp_lin_3d( xb % u, xp, i, j, dx, dy, dxm, dym, &
79 model_u, max_ob_levels, iv%pilot(n)%zk, num_levs)
80 call da_interp_lin_3d( xb % v, xp, i, j, dx, dy, dxm, dym, &
81 model_v, max_ob_levels, iv%pilot(n)%zk, num_levs)
82
83 !------------------------------------------------------------------------
84 ! [2.0] Initialise components of innovation vector:
85 !------------------------------------------------------------------------
86
87 do k = 1, iv % pilot(n) % info % levels
88 iv % pilot(n) % u(k) % inv = 0.0
89 iv % pilot(n) % v(k) % inv = 0.0
90
91 !------------------------------------------------------------------------
92 ! [4.0] Fast interpolation:
93 !------------------------------------------------------------------------
94
95 if (ob % pilot(n) % u(k) > missing_r .AND. &
96 iv % pilot(n) % u(k) % qc >= obs_qc_pointer) then
97 iv % pilot(n) % u(k) % inv = ob % pilot(n) % u(k) - model_u(k)
98 end if
99
100 if (ob % pilot(n) % v(k) > missing_r .AND. &
101 iv % pilot(n) % v(k) % qc >= obs_qc_pointer) then
102 iv % pilot(n) % v(k) % inv = ob % pilot(n) % v(k) - model_v(k)
103 end if
104 end do
105
106 !------------------------------------------------------------------------
107 ! [5.0] Perform optional maximum error check:
108 !------------------------------------------------------------------------
109
110 if (check_max_iv) then
111 call da_check_max_iv_pilot(it, iv % pilot(n), 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)')'For outer iteration ',it, &
117 ', Total Rejections for Pilot 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 Pilot rejections ',ituf+itvvf,' on ',itu+itvv
122 end if
123
124 if (trace_use) call da_trace_exit("da_get_innov_vector_pilot")
125
126 end subroutine da_get_innov_vector_pilot
127
128