da_biascorr.inc

References to this file elsewhere.
1 subroutine da_biascorr ( i, ob, iv)
2 
3    !---------------------------------------------------------------------------
4    ! Purpose: perform bias correction for radiance data.
5    !
6    ! METHOD:  omb(corrected)=omb-scanbias-airbias
7    !---------------------------------------------------------------------------
8 
9    implicit none
10 
11    integer,        intent(in)    :: i       ! sensor index.
12    type (y_type),  intent(in)    :: ob      ! Observation structure.
13    type (iv_type), intent(inout) :: iv      ! O-B structure.
14 
15    ! Local variables
16    integer   :: k,iband,iscan, n,j,npred,nlevels
17    real      :: q(43),pred(4),airbias
18 
19    if (trace_use) call da_trace_entry("da_biascorr")
20 
21    npred=4
22    nlevels=iv%instid(i)%nlevels-1
23 
24    do n=iv%instid(i)%info%n1,iv%instid(i)%info%n2
25       ! get airmass predictors
26       !-------------------------
27         if (rtm_option==rtm_option_rttov) then
28          q(1:43) = iv%instid(i)%mr(1:43,n)/q2ppmv
29          call da_predictor_rttov(pred(1:npred), npred, iv%instid(i)%t(1:43,n), &
30             q(1:43), iv%instid(i)%ts(n))
31         else if (rtm_option==rtm_option_crtm) then
32 #ifdef CRTM
33          call da_predictor_crtm(pred(1:npred), npred, nlevels,iv%instid(i)%tm(1:nlevels,n), &
34             iv%instid(i)%qm(1:nlevels,n), iv%instid(i)%ts(n), &
35             iv%instid(i)%pm(1:nlevels,n),iv%instid(i)%pf(0:nlevels,n))
36 #endif
37         end if
38         iscan = iv%instid(i)%scanpos(n)
39         iband = floor(iv%instid(i)%info%lat(1,n)/10.0001) + 10
40       do k=1,iv%instid(i)%nchan
41        ! scan bias correction
42        !-----------------------
43         if (global) then
44           iv%instid(i)%tb_inv(k,n) = iv%instid(i)%tb_inv(k,n) - satinfo(i)%scanbias_b(k,iscan,iband)
45         else
46           iv%instid(i)%tb_inv(k,n) = iv%instid(i)%tb_inv(k,n) - satinfo(i)%scanbias(k,iscan) 
47         end if
48        ! airmass bias correction
49        !----------------------------
50           airbias = satinfo(i)%bcoef0(k)
51          do j=1,npred
52           airbias= airbias + satinfo(i)%bcoef(k,j)*pred(j)
53          end do
54           iv%instid(i)%tb_inv(k,n) = iv%instid(i)%tb_inv(k,n)-airbias
55         !if (k==5) then
56         !  write(*,'(6f15.5)') satinfo(i)%scanbias(k,iscan), satinfo(i)%bcoef(k,1:npred),satinfo(i)%bcoef0(k)
57         !  write(*,'(5f15.5)') airbias,pred(1:npred)
58         !end if
59       end do
60    end do
61 
62    if (trace_use) call da_trace_exit("da_biascorr")
63 
64 end subroutine da_biascorr
65