3 use rad_bias
, only
: bias
, long
, jpchan
, jpscan
,jband
, jpnx
, &
4 da_read_biasprep
, read_biascoef
, get_scorr
, qc_amsua
, qc_amsub
, mask
, &
5 write_biascoef
, jpny
, qc_ssmis
9 ! Apply bias correction to radiance data
10 ! to statistically verify algorithm
16 real (kind
=long
) :: vmean_dep(JPCHAN
), vmean_abs(JPCHAN
)
17 real (kind
=long
) :: vec_dep(JPCHAN
), vec_abs(JPCHAN
)
18 real (kind
=long
) :: vstd_dep(JPCHAN
), vstd_abs(JPCHAN
)
19 real (kind
=long
) :: vmean_dep1(JPCHAN
), vmean_abs1(JPCHAN
)
20 real (kind
=long
) :: vstd_dep1(JPCHAN
), vstd_abs1(JPCHAN
)
22 real (kind
=long
) :: airbias(JPCHAN
)
24 real (kind
=long
) :: xcoef0(JPCHAN
), xcoef(JPCHAN
,JPNX
)
26 real (kind
=long
) :: vmnrl(JPCHAN
,JPSCAN
) = 0.0
27 real (kind
=long
) :: vmnrlb(JPCHAN
,JPSCAN
,JBAND
) = 0.0
29 real (kind
=long
) :: SCORR(JPCHAN
)
32 integer :: nobs(JPCHAN
),nobs1(JPCHAN
)
36 logical :: lscan
= .FALSE
.
38 integer :: I
, iband
, ierr
39 integer :: J
, JSCAN
, jv
43 logical :: check_limb
=.false
., check_mask
=.false
., global
44 real :: FAC
= 3.0 ! Number of SD' for QC
46 integer :: nchan
,nscan
,nband
,npred
48 namelist /INPUTS
/ global
,lscan
, kscanx
, check_limb
, check_mask
, FAC
50 !------------------------------------------------------------------------------
53 read (5,INPUTS
,end=100)
57 ! 1.0 read bias correction coefficients
58 ! -------------------------------------------------------------
59 open(unit
=12,file
='scor.asc',form
='formatted')
60 read (12,'(4i6)') nchan
,nscan
,nband
,npred
63 call read_biascoef(nchan
,nscan
,nband
,npred
,global
, &
64 VMNRL(1:nchan
,1:nscan
),VMNRLB(1:nchan
,1:nscan
,1:nband
), &
65 xcoef(1:nchan
,1:npred
),xcoef0(1:nchan
), &
66 nobs(1:nchan
),vmean_abs(1:nchan
), &
67 vstd_abs(1:nchan
),vmean_dep(1:nchan
), &
70 !----------------------------------------------------------------------
71 ! 2. READ IN DATA, Q.C., CALC MEANS AND VARIANCES.
72 ! ---- -- ----- ----- ---- ----- --- ---------
81 read (unit
=10,end=300) tovs
%nchan
, tovs
%npred
! Read in data
84 allocate(tovs
%tb(tovs
%nchan
))
85 allocate(tovs
%omb(tovs
%nchan
))
86 allocate(tovs
%bias(tovs
%nchan
))
87 allocate(tovs
%qc_flag(tovs
%nchan
))
88 allocate(tovs
%cloud_flag(tovs
%nchan
))
89 allocate(tovs
%pred(tovs
%npred
))
95 call da_read_biasprep(tovs
,10,ierr
)
96 if (ierr
== 0) then ! not end
98 elseif (ierr
== 1) then ! end
101 stop 'read error in da_veri_bias'
105 iband
= INT(tovs
%lat
/30.000001) + 3
109 call GET_SCORR(JPCHAN
,SCORR(1:JPCHAN
),tovs
%lat
,vmnrlb
,JSCAN
)
111 SCORR(1:nchan
) = vmnrl(1:nchan
,JSCAN
)
115 SCORR(1:JPCHAN
) = 0.0
118 vec_dep(1:nchan
) = tovs
%omb(1:nchan
) - SCORR(1:nchan
)
119 vec_abs(1:nchan
) = tovs
%tb(1:nchan
) - SCORR(1:nchan
)
122 if (tovs
%sensor_id
== 3) then
124 elseif(tovs
%sensor_id
== 4) then
126 elseif(tovs
%sensor_id
== 15) then ! mhs
128 elseif(tovs
%sensor_id
== 10) then ! ssmis
132 ! 3.3 limb scan check
133 !---------------------
135 if ((tovs
%scanpos
<= 2) .OR
. (tovs
%scanpos
>= (KSCANX
-1))) then
136 nsel(2) = nsel(2) + 1
141 ! 3.4 Reject data outside radiosonde mask
142 !------------------------------------------
144 call MASK(tovs
%lat
,tovs
%lon
,LMASK
)
145 if (.NOT
. LMASK
) then
146 nsel(8) = nsel(8) + 1
151 ! 3.5 Reject outliers : facx*sigma,
152 !--------------------------------------------------------------------------
154 if ( (abs(vec_dep(j
)-vmean_dep(j
)) > (vstd_dep(j
)*FAC
)) ) then
160 airbias(i
) = xcoef0(i
)
162 airbias(i
) = airbias(i
) + tovs
%pred(j
)*xcoef(i
,j
)
164 vec_dep(i
) = vec_dep(i
) - airbias(i
)
165 vec_abs(i
) = vec_abs(i
) - airbias(i
)
166 if ( tovs
%omb(i
) == -888888.00 ) vec_dep(i
)=tovs
%omb(i
)
169 ! mean/std statistics for scan/airmass-bias corrected values
171 if ( tovs
%qc_flag(j
) == 1 ) then
173 nobs1(j
) = nobs1(j
) + 1
174 vmean_dep1(j
) = vmean_dep1(j
) + vec_dep(j
)
175 vstd_dep1(j
) = vstd_dep1(j
) + vec_dep(j
)*vec_dep(j
)
176 vmean_abs1(j
) = vmean_abs1(j
) + vec_abs(j
)
177 vstd_abs1(j
) = vstd_abs1(j
) + vec_abs(j
)*vec_abs(j
)
181 write (11,'(30i15)') tovs
%qc_flag(1:nchan
)
182 write (11,'(30f15.3)') tovs
%omb(1:nchan
) ! omb no-biascorrection
183 write (11,'(30f15.3)') vec_dep(1:nchan
) ! omb with bias correction
187 ! Calculate means, standard deviations and covariances
189 where (nobs1(:) /= 0)
190 vmean_dep1(:) = vmean_dep1(:)/nobs1(:)
191 vstd_dep1(:) = vstd_dep1(:)/nobs1(:) - vmean_dep1(:)**2
192 vstd_dep1(:) = SQRT(MAX(0.0_8
,vstd_dep1(:)))
193 vmean_abs1(:) = vmean_abs1(:)/nobs1(:)
194 vstd_abs1(:) = vstd_abs1(:)/nobs1(:) - vmean_abs1(:)**2
195 vstd_abs1(:) = SQRT(MAX(0.0_8
,vstd_abs1(:)))
198 !----------------------------------------------------------------------------
202 deallocate(tovs
%qc_flag
)
203 deallocate(tovs
%cloud_flag
)
204 deallocate(tovs
%pred
)
206 ! out coefs to ASCII file bcor.asc
207 call write_biascoef(nchan
,nscan
,nband
,npred
,global
, &
208 VMNRL(1:nchan
,1:nscan
),VMNRLB(1:nchan
,1:nscan
,1:nband
), &
209 xcoef(1:nchan
,1:npred
),xcoef0(1:nchan
), &
210 nobs1(1:nchan
),vmean_abs1(1:nchan
), &
211 vstd_abs1(1:nchan
),vmean_dep1(1:nchan
), &
214 end program da_bias_verif