Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / var / da / da_lightning / da_check_max_iv_lightning.inc
blobe79cbe36733d8605d5938e2fd2b6476fa00eed7e
1 subroutine da_check_max_iv_lightning(iv,ob, it)
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    ! Authors: Z Chen (zchen@fjnu.edu.cn), Jenny Sun (NCAR), X Qie (IAP)
6    !-----------------------------------------------------------------------
8    implicit none
10    type(iv_type), intent(inout) :: iv
11    integer,       intent(in)    :: it      ! Outer iteration 
12    type(y_type),  intent(in)    :: ob      ! Observation structure.
14    logical :: failed 
15    integer :: n, k
16    
17    if (trace_use) call da_trace_entry("da_check_max_iv_lightning")       
19    !---------------------------------------------------------------------------
20    ! [1.0] Perform maximum innovation vector check:
21    !---------------------------------------------------------------------------
23    do n = iv%info(lightning)%n1,iv%info(lightning)%n2
24       do k = 1, iv%info(lightning)%levels(n)
25          failed = .false.
26          if(iv%lightning(n)%w(k)%qc >= obs_qc_pointer) then 
27             call da_max_error_qc(it, iv%info(lightning), n, iv%lightning(n)%w(k),max_error_lda_w, failed)
28             if(iv%info(lightning)%proc_domain(k,n)) then
29               if(failed) then
30                 write(qcstat_conv_unit,'(2x, a10, 2x, a10, 4f12.3, a12)')&
31                   'Lightning','lightning',iv%info(lightning)%lat(k,n),iv%info(lightning)%lon(k,n), iv%lightning(n)%w(k)%inv, ob%lightning(n)%w(k)
32               end if
33             end if
34          end if
36          failed = .false.
37          if(iv%lightning(n)%div(k)%qc >= obs_qc_pointer) then
38             call da_max_error_qc(it, iv%info(lightning), n, iv%lightning(n)%div(k),max_error_lda_div, failed)
39             if(iv%info(lightning)%proc_domain(k,n)) then
40               if(failed) then
41                 write(qcstat_conv_unit,'(2x, a10, 2x, a10, 4f12.3, a12)')&
42                   'Lightning','lightning',iv%info(lightning)%lat(k,n),iv%info(lightning)%lon(k,n), iv%lightning(n)%div(k)%inv, ob%lightning(n)%div(k)
43               end if
44             end if
45          end if
46                  
47         failed = .false.
48          if(iv%lightning(n)%qv(k)%qc >= obs_qc_pointer) then 
49             call da_max_error_qc(it, iv%info(lightning), n, iv%lightning(n)%qv(k),max_error_lda_qv, failed)
50             if(iv%info(lightning)%proc_domain(k,n)) then
51               if(failed)then
52                 write(qcstat_conv_unit,'(2x,a10,2x,a10,4f12.2,a12)')&
53                   'Lightning','lightning',iv%info(lightning)%lat(k,n),iv%info(lightning)%lon(k,n), iv%lightning(n)%qv(k)%inv, ob%lightning(n)%qv(k)
54               end if
55             end if
56          end if
57       end do
58    end do
60    if (trace_use) call da_trace_exit("da_check_max_iv_lightning")       
62 end subroutine da_check_max_iv_lightning