1 subroutine da_check_max_iv_metar(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.
18 logical :: failed,failed1,failed2
21 if (trace_use_dull) call da_trace_entry("da_check_max_iv_metar")
23 !---------------------------------------------------------------------------
24 ! [1.0] Perform maximum innovation vector check:
25 !---------------------------------------------------------------------------
27 do n=iv%info(metar)%n1,iv%info(metar)%n2
28 if(.not. qc_rej_both)then
31 if( iv%metar(n)%u%qc >= obs_qc_pointer ) then
32 call da_max_error_qc (it,iv%info(metar), n, iv%metar(n)%u, max_error_spd,failed)
33 if( iv%info(metar)%proc_domain(1,n) ) then
34 num_qcstat_conv(1,metar,1,1) = num_qcstat_conv(1,metar,1,1) + 1
36 num_qcstat_conv(2,metar,1,1) = num_qcstat_conv(2,metar,1,1) + 1
37 if ( write_rej_obs_conv ) then
38 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
39 'metar',ob_vars(1),iv%info(metar)%lat(1,n),iv%info(metar)%lon(1,n),0.01*ob%metar(n)%p
46 if( iv%metar(n)%v%qc >= obs_qc_pointer ) then
47 call da_max_error_qc (it,iv%info(metar), n, iv%metar(n)%v, max_error_dir,failed)
48 if( iv%info(metar)%proc_domain(1,n) ) then
49 num_qcstat_conv(1,metar,2,1) = num_qcstat_conv(1,metar,2,1) + 1
51 num_qcstat_conv(2,metar,2,1) = num_qcstat_conv(2,metar,2,1) + 1
52 if ( write_rej_obs_conv ) then
53 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
54 'metar',ob_vars(2),iv%info(metar)%lat(1,n),iv%info(metar)%lon(1,n),0.01*ob%metar(n)%p
61 if( iv%metar(n)%u%qc >= obs_qc_pointer ) then
62 call da_max_error_qc (it,iv%info(metar), n, iv%metar(n)%u, max_error_uv,failed)
63 if( iv%info(metar)%proc_domain(1,n) ) then
64 num_qcstat_conv(1,metar,1,1) = num_qcstat_conv(1,metar,1,1) + 1
66 num_qcstat_conv(2,metar,1,1) = num_qcstat_conv(2,metar,1,1) + 1
67 if ( write_rej_obs_conv ) then
68 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
69 'metar',ob_vars(1),iv%info(metar)%lat(1,n),iv%info(metar)%lon(1,n),0.01*ob%metar(n)%p
75 if( iv%metar(n)%v%qc >= obs_qc_pointer ) then
76 call da_max_error_qc (it,iv%info(metar), n, iv%metar(n)%v, max_error_uv,failed)
77 if( iv%info(metar)%proc_domain(1,n) ) then
78 num_qcstat_conv(1,metar,2,1) = num_qcstat_conv(1,metar,2,1) + 1
80 num_qcstat_conv(2,metar,2,1) = num_qcstat_conv(2,metar,2,1) + 1
81 if ( write_rej_obs_conv ) then
82 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
83 'metar',ob_vars(2),iv%info(metar)%lat(1,n),iv%info(metar)%lon(1,n),0.01*ob%metar(n)%p
91 if(iv%metar(n)%u%qc == fails_error_max .or. abs(iv%metar(n)%u%inv) >= max_omb_spd) then
92 iv%metar(n)%u%qc = fails_error_max
93 iv%metar(n)%u%inv = 0.0
95 if(iv%metar(n)%v%qc == fails_error_max .or. abs(iv%metar(n)%v%inv) >= max_omb_dir) then
96 iv%metar(n)%v%qc = fails_error_max
97 iv%metar(n)%v%inv = 0.0
103 if( iv%metar(n)%v%qc >= obs_qc_pointer .or. iv%metar(n)%u%qc >= obs_qc_pointer ) then
104 if(wind_sd_metar)then
105 call da_max_error_qc (it,iv%info(metar), n, iv%metar(n)%u, max_error_spd,failed1)
106 call da_max_error_qc (it,iv%info(metar), n, iv%metar(n)%v, max_error_dir,failed2)
108 call da_max_error_qc (it,iv%info(metar), n, iv%metar(n)%u, max_error_uv,failed1)
109 call da_max_error_qc (it,iv%info(metar), n, iv%metar(n)%v, max_error_uv,failed2)
113 if( iv%info(metar)%proc_domain(1,n) ) then
114 num_qcstat_conv(1,metar,1,1) = num_qcstat_conv(1,metar,1,1) + 1
115 num_qcstat_conv(1,metar,2,1) = num_qcstat_conv(1,metar,2,1) + 1
117 if(failed1 .or. failed2) then
118 num_qcstat_conv(2,metar,1,1) = num_qcstat_conv(2,metar,1,1) + 1
119 if ( write_rej_obs_conv ) then
120 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
121 'metar',ob_vars(1),iv%info(metar)%lat(1,n),iv%info(metar)%lon(1,n),0.01*ob%metar(n)%p
123 num_qcstat_conv(2,metar,2,1) = num_qcstat_conv(2,metar,2,1) + 1
124 if ( write_rej_obs_conv ) then
125 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
126 'metar',ob_vars(2),iv%info(metar)%lat(1,n),iv%info(metar)%lon(1,n),0.01*ob%metar(n)%p
131 if(wind_sd_metar)then
132 if(iv%metar(n)%u%qc == fails_error_max .or. iv%metar(n)%v%qc == fails_error_max .or. &
133 abs(iv%metar(n)%v%inv) >= max_omb_dir .or. abs(iv%metar(n)%u%inv) >= max_omb_spd )then
134 iv%metar(n)%u%qc = fails_error_max
135 iv%metar(n)%v%qc = fails_error_max
136 iv%metar(n)%u%inv = 0.0
137 iv%metar(n)%v%inv = 0.0
140 if(iv%metar(n)%u%qc == fails_error_max .or. iv%metar(n)%v%qc == fails_error_max ) then
141 iv%metar(n)%u%qc = fails_error_max
142 iv%metar(n)%v%qc = fails_error_max
143 iv%metar(n)%u%inv = 0.0
144 iv%metar(n)%v%inv = 0.0
150 if( iv%metar(n)%t%qc >= obs_qc_pointer ) then
151 call da_max_error_qc (it, iv%info(metar), n, iv%metar(n)%t, max_error_t , failed)
152 if( iv%info(metar)%proc_domain(1,n) ) then
153 num_qcstat_conv(1,metar,3,1)= num_qcstat_conv(1,metar,3,1) + 1
155 num_qcstat_conv(2,metar,3,1)= num_qcstat_conv(2,metar,3,1) + 1
156 if ( write_rej_obs_conv ) then
157 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
158 'metar',ob_vars(3),iv%info(metar)%lat(1,n),iv%info(metar)%lon(1,n),0.01*ob%metar(n)%p
165 if( iv%metar(n)%p%qc >= obs_qc_pointer ) then
166 call da_max_error_qc (it, iv%info(metar), n, iv%metar(n)%p, max_error_p , failed)
167 if( iv%info(metar)%proc_domain(1,n) ) then
168 num_qcstat_conv(1,metar,5,1)= num_qcstat_conv(1,metar,5,1) + 1
170 num_qcstat_conv(2,metar,5,1)= num_qcstat_conv(2,metar,5,1) + 1
171 if ( write_rej_obs_conv ) then
172 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
173 'metar',ob_vars(5),iv%info(metar)%lat(1,n),iv%info(metar)%lon(1,n),0.01*ob%metar(n)%p
180 if( iv%metar(n)%q%qc >= obs_qc_pointer ) then
181 if( iv%metar(n)%t%qc == fails_error_max .or. iv%metar(n)%p%qc == fails_error_max) then
183 iv%metar(n)%q%qc = fails_error_max
184 iv%metar(n)%q%inv = 0.0
186 call da_max_error_qc (it, iv%info(metar), n, iv%metar(n)%q, max_error_q , failed)
188 if( iv%info(metar)%proc_domain(1,n) ) then
189 num_qcstat_conv(1,metar,4,1)= num_qcstat_conv(1,metar,4,1) + 1
191 num_qcstat_conv(2,metar,4,1)= num_qcstat_conv(2,metar,4,1) + 1
192 if ( write_rej_obs_conv ) then
193 write(qcstat_conv_unit,'(2x,a10,2x,a4,3f12.2)')&
194 'metar',ob_vars(4),iv%info(metar)%lat(1,n),iv%info(metar)%lon(1,n),0.01*ob%metar(n)%p
201 if (trace_use_dull) call da_trace_exit("da_check_max_iv_metar")
203 end subroutine da_check_max_iv_metar