1 subroutine da_check_max_iv_buoy(iv,ob, it, num_qcstat_conv)
3 !-----------------------------------------------------------------------
6 ! Removed Outerloop check as it is done in da_get_innov
7 ! Author: Syed RH Rizvi, MMM/NESL/NCAR, Date: 07/12/2009
8 !-----------------------------------------------------------------------
12 type(iv_type), intent(inout) :: iv
13 integer, intent(in) :: it ! Outer iteration
14 integer, intent(inout) :: num_qcstat_conv(:,:,:,:)
15 type(y_type), intent(in) :: ob ! Observation structure.
17 logical :: failed,failed1,failed2
20 if (trace_use_dull) call da_trace_entry("da_check_max_iv_buoy")
23 !---------------------------------------------------------------------------
24 ! [1.0] Perform maximum innovation vector check:
25 !---------------------------------------------------------------------------
27 do n=iv%info(buoy)%n1,iv%info(buoy)%n2
28 if(.not. qc_rej_both)then
31 if( iv%buoy(n)%u%qc >= obs_qc_pointer ) then
32 call da_max_error_qc (it,iv%info(buoy), n, iv%buoy(n)%u, max_error_spd,failed)
33 if( iv%info(buoy)%proc_domain(1,n) ) then
34 num_qcstat_conv(1,buoy,1,1) = num_qcstat_conv(1,buoy,1,1) + 1
36 num_qcstat_conv(2,buoy,1,1) = num_qcstat_conv(2,buoy,1,1) + 1
37 if ( write_rej_obs_conv ) then
38 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
39 'buoy',ob_vars(1),iv%info(buoy)%lat(1,n),iv%info(buoy)%lon(1,n),0.01*ob%buoy(n)%p
46 if( iv%buoy(n)%v%qc >= obs_qc_pointer ) then
47 call da_max_error_qc (it,iv%info(buoy), n, iv%buoy(n)%v, max_error_dir,failed)
48 if( iv%info(buoy)%proc_domain(1,n) ) then
49 num_qcstat_conv(1,buoy,2,1) = num_qcstat_conv(1,buoy,2,1) + 1
51 num_qcstat_conv(2,buoy,2,1) = num_qcstat_conv(2,buoy,2,1) + 1
52 if ( write_rej_obs_conv ) then
53 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
54 'buoy',ob_vars(2),iv%info(buoy)%lat(1,n),iv%info(buoy)%lon(1,n),0.01*ob%buoy(n)%p
63 if( iv%buoy(n)%u%qc >= obs_qc_pointer ) then
64 call da_max_error_qc (it,iv%info(buoy), n, iv%buoy(n)%u, max_error_uv,failed)
65 if( iv%info(buoy)%proc_domain(1,n) ) then
66 num_qcstat_conv(1,buoy,1,1) = num_qcstat_conv(1,buoy,1,1) + 1
68 num_qcstat_conv(2,buoy,1,1) = num_qcstat_conv(2,buoy,1,1) + 1
69 if ( write_rej_obs_conv ) then
70 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
71 'buoy',ob_vars(1),iv%info(buoy)%lat(1,n),iv%info(buoy)%lon(1,n),0.01*ob%buoy(n)%p
78 if( iv%buoy(n)%v%qc >= obs_qc_pointer ) then
79 call da_max_error_qc (it,iv%info(buoy), n, iv%buoy(n)%v, max_error_uv,failed)
80 if( iv%info(buoy)%proc_domain(1,n) ) then
81 num_qcstat_conv(1,buoy,2,1) = num_qcstat_conv(1,buoy,2,1) + 1
83 num_qcstat_conv(2,buoy,2,1) = num_qcstat_conv(2,buoy,2,1) + 1
84 if ( write_rej_obs_conv ) then
85 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
86 'buoy',ob_vars(2),iv%info(buoy)%lat(1,n),iv%info(buoy)%lon(1,n),0.01*ob%buoy(n)%p
93 if(iv%buoy(n)%u%qc == fails_error_max .or. abs(iv%buoy(n)%u%inv) >= max_omb_spd) then
94 iv%buoy(n)%u%qc = fails_error_max
95 iv%buoy(n)%u%inv = 0.0
97 if(iv%buoy(n)%v%qc == fails_error_max .or. abs(iv%buoy(n)%v%inv) >= max_omb_dir) then
98 iv%buoy(n)%v%qc = fails_error_max
99 iv%buoy(n)%v%inv = 0.0
107 if( iv%buoy(n)%v%qc >= obs_qc_pointer .or. iv%buoy(n)%u%qc >= obs_qc_pointer ) then
109 call da_max_error_qc (it,iv%info(buoy), n, iv%buoy(n)%u, max_error_spd,failed1)
110 call da_max_error_qc (it,iv%info(buoy), n, iv%buoy(n)%v, max_error_dir,failed2)
112 call da_max_error_qc (it,iv%info(buoy), n, iv%buoy(n)%u, max_error_uv,failed1)
113 call da_max_error_qc (it,iv%info(buoy), n, iv%buoy(n)%v, max_error_uv,failed2)
117 if( iv%info(buoy)%proc_domain(1,n) ) then
118 num_qcstat_conv(1,buoy,1,1) = num_qcstat_conv(1,buoy,1,1) + 1
119 num_qcstat_conv(1,buoy,2,1) = num_qcstat_conv(1,buoy,2,1) + 1
121 if(failed1 .or. failed2) then
122 num_qcstat_conv(2,buoy,1,1) = num_qcstat_conv(2,buoy,1,1) + 1
123 if ( write_rej_obs_conv ) then
124 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
125 'buoy',ob_vars(1),iv%info(buoy)%lat(1,n),iv%info(buoy)%lon(1,n),0.01*ob%buoy(n)%p
127 num_qcstat_conv(2,buoy,2,1) = num_qcstat_conv(2,buoy,2,1) + 1
128 if ( write_rej_obs_conv ) then
129 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
130 'buoy',ob_vars(2),iv%info(buoy)%lat(1,n),iv%info(buoy)%lon(1,n),0.01*ob%buoy(n)%p
136 if(iv%buoy(n)%u%qc == fails_error_max .or. iv%buoy(n)%v%qc == fails_error_max .or. &
137 abs(iv%buoy(n)%v%inv) >= max_omb_dir .or. abs(iv%buoy(n)%u%inv) >= max_omb_spd )then
138 iv%buoy(n)%u%qc = fails_error_max
139 iv%buoy(n)%v%qc = fails_error_max
140 iv%buoy(n)%u%inv = 0.0
141 iv%buoy(n)%v%inv = 0.0
144 if(iv%buoy(n)%u%qc == fails_error_max .or. iv%buoy(n)%v%qc == fails_error_max ) then
145 iv%buoy(n)%u%qc = fails_error_max
146 iv%buoy(n)%v%qc = fails_error_max
147 iv%buoy(n)%u%inv = 0.0
148 iv%buoy(n)%v%inv = 0.0
154 if( iv%buoy(n)%t%qc >= obs_qc_pointer ) then
155 call da_max_error_qc (it, iv%info(buoy), n, iv%buoy(n)%t, max_error_t , failed)
156 if( iv%info(buoy)%proc_domain(1,n) ) then
157 num_qcstat_conv(1,buoy,3,1)= num_qcstat_conv(1,buoy,3,1) + 1
159 num_qcstat_conv(2,buoy,3,1)= num_qcstat_conv(2,buoy,3,1) + 1
160 if ( write_rej_obs_conv ) then
161 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
162 'buoy',ob_vars(3),iv%info(buoy)%lat(1,n),iv%info(buoy)%lon(1,n),0.01*ob%buoy(n)%p
169 if( iv%buoy(n)%p%qc >= obs_qc_pointer ) then
170 call da_max_error_qc (it, iv%info(buoy), n, iv%buoy(n)%p, max_error_p , failed)
171 if( iv%info(buoy)%proc_domain(1,n) ) then
172 num_qcstat_conv(1,buoy,5,1)= num_qcstat_conv(1,buoy,5,1) + 1
174 num_qcstat_conv(2,buoy,5,1)= num_qcstat_conv(2,buoy,5,1) + 1
175 if ( write_rej_obs_conv ) then
176 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
177 'buoy',ob_vars(5),iv%info(buoy)%lat(1,n),iv%info(buoy)%lon(1,n),0.01*ob%buoy(n)%p
185 if( iv%buoy(n)%q%qc >= obs_qc_pointer ) then
186 if( iv%buoy(n)%t%qc == fails_error_max .or. iv%buoy(n)%p%qc == fails_error_max) then
188 iv%buoy(n)%q%qc = fails_error_max
189 iv%buoy(n)%q%inv = 0.0
191 call da_max_error_qc (it, iv%info(buoy), n, iv%buoy(n)%q, max_error_q , failed)
193 if( iv%info(buoy)%proc_domain(1,n) ) then
194 num_qcstat_conv(1,buoy,4,1)= num_qcstat_conv(1,buoy,4,1) + 1
196 num_qcstat_conv(2,buoy,4,1)= num_qcstat_conv(2,buoy,4,1) + 1
197 if ( write_rej_obs_conv ) then
198 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
199 'buoy',ob_vars(4),iv%info(buoy)%lat(1,n),iv%info(buoy)%lon(1,n),0.01*ob%buoy(n)%p
207 if (trace_use_dull) call da_trace_exit("da_check_max_iv_buoy")
209 end subroutine da_check_max_iv_buoy