Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / var / da / da_radiance / da_radiance1.f90
blobd53688d6a5e0e43deb0f3f03b3f6db1c35d73fbb
1 module da_radiance1
3 !---------------------------------------------------------------------------
4 ! Purpose: module for radiance data assimilation.
5 !---------------------------------------------------------------------------
7 #if defined(RTTOV) || defined(CRTM)
8 use module_radiance, only : satinfo,q2ppmv,rttov_inst_name,deg2rad
9 #ifdef CRTM
10 use module_radiance, only : CRTM_Planck_Radiance, CRTM_Planck_Temperature
11 #endif
12 use module_radiance, only : &
13 #ifdef RTTOV
14 coefs, &
15 #endif
16 deg2rad
18 use da_control, only : trace_use,missing_r, rootproc, &
19 stdout,myproc,qc_good,num_fgat_time,qc_bad, &
20 use_error_factor_rad,biasprep_unit,obs_qc_pointer, filename_len, &
21 print_detail_rad, rtm_option, trace_use_dull, &
22 rtm_option_rttov,rtm_option_crtm, radiance, only_sea_rad, &
23 global, gas_constant, gravity, monitor_on,kts,kte,use_rttov_kmatrix, &
24 use_pseudo_rad, pi, t_triple, crtm_cloud, DT_cloud_model,write_jacobian, &
25 use_crtm_kmatrix,use_clddet, use_satcv, cv_size_domain, &
26 cv_size_domain_js, calc_weightfunc, deg_to_rad, rad_to_deg,use_clddet_zz, &
27 ahi_superob_halfwidth, abi_superob_halfwidth, ahi_use_symm_obs_err, abi_use_symm_obs_err
28 use da_define_structures, only : info_type,model_loc_type,maxmin_type, &
29 iv_type, y_type, jo_type,bad_data_type,bad_data_type,number_type, &
30 be_type, clddet_geoir_type, superob_type
31 use module_dm, only : wrf_dm_sum_real, wrf_dm_sum_integer
32 #ifdef DM_PARALLEL
33 use da_par_util, only : da_proc_stats_combine, true_mpi_real
34 #else
35 use da_par_util, only : da_proc_stats_combine
36 #endif
37 use da_par_util1, only : da_proc_sum_int,da_proc_sum_ints
38 use da_reporting, only : da_error, message
39 use da_statistics, only : da_stats_calculate
40 use da_tools, only : da_residual_new, da_eof_decomposition
41 use da_tools_serial, only : da_free_unit, da_get_unit
42 use da_tracing, only : da_trace_entry, da_trace_exit, da_trace_int_sort
43 use da_wrf_interfaces, only : wrf_dm_bcast_integer
45 #if defined(RTTOV) || defined(CRTM)
46 use da_control, only : rtminit_sensor,write_profile,num_procs,tovs_min_transfer
47 use da_reporting, only : da_warning, da_message
48 use da_tracing, only : da_trace
49 #endif
51 #ifdef DM_PARALLEL
52 use da_control, only : ierr,comm,root
53 use da_par_util1, only : true_mpi_real, mpi_sum,mpi_integer
54 #endif
56 implicit none
58 type datalink_type
60 type (info_type) :: info
61 type (model_loc_type) :: loc
62 type (clddet_geoir_type) :: cld_qc
63 type (superob_type), allocatable :: superob(:,:)
64 integer :: ifgat, landsea_mask, rain_flag
65 integer :: scanline, scanpos
66 real :: satzen, satazi, solzen, solazi ! satellite and solar angles
67 ! channels' bright temperature
68 real, pointer :: emiss(:)
69 ! logical, pointer :: calcemis(:)
70 integer, pointer :: cloud_flag(:)
71 real, pointer :: t(:), mr(:), zk(:)
72 real, pointer :: pm(:), tm(:), qm(:), qrn(:), qcw(:),qci(:),qsn(:),qgr(:)
73 real :: ps,ts,t2m,mr2m,u10,v10, clwp
74 real :: smois, tslb, snowh, elevation,soiltyp,vegtyp,vegfra
75 real :: clw
76 integer :: isflg
77 integer :: cloudflag
79 ! real, pointer :: tb_xb(:)
80 real, pointer :: tb_ob(:)
81 real, pointer :: tb_inv(:)
82 real, pointer :: tb_qc(:)
83 real, pointer :: tb_error(:)
84 real, pointer :: rad_obs(:)
85 integer :: sensor_index
86 type (datalink_type), pointer :: next ! pointer to next data
87 end type datalink_type
89 type con_vars_type
90 integer :: nlevels
91 real , pointer :: t(:)
92 real , pointer :: q(:)
93 real :: ps
94 real , pointer :: t_jac(:,:) => null()
95 real , pointer :: q_jac(:,:) => null()
96 real , pointer :: ps_jac(:) => null()
97 end type con_vars_type
99 type con_cld_vars_type
100 integer :: nwp_levels
101 real , pointer :: p(:)
102 real , pointer :: ph(:)
103 real , pointer :: t(:)
104 real , pointer :: cc(:)
105 real , pointer :: clw(:) ! kg/kg
106 real , pointer :: ciw(:) ! kg/kg
107 real , pointer :: rain(:) ! kg/m2/s
108 real , pointer :: sp(:) ! kg/m2/s
109 integer , pointer :: cloudflag(:)
110 end type con_cld_vars_type
112 type aux_vars_type
113 integer :: surftype
114 real :: surft, t2m, q2m, u10, v10
115 real :: satzen, satazi !!, fastem(5)
116 real :: solzen, solazi
117 real :: elevation ,rlat
118 end type aux_vars_type
120 type maxmin_rad_stats_type
121 type (maxmin_type) :: maximum, minimum
122 real :: ave, rms
123 integer :: num
124 end type maxmin_rad_stats_type
126 type stats_rad_type
127 type (maxmin_rad_stats_type), pointer :: ichan(:)
128 end type stats_rad_type
130 type rad_header_type ! innovation file header
131 character (LEN = 19) :: date_char ! YYYY-MM-DD-HH (assimilation window date)
132 integer :: assim_win ! assimilation window hours, e.g., 6 hours
133 character(LEN=20) :: rttovid_string ! e.g., noaa-16-amsua
134 integer :: platform_id ! e.g., 1 for noaa (see RTTOV UG)
135 integer :: satellite_id ! e.g., 16 for noaa-16
136 integer :: sensor_id ! e.g., 3 for amsua
137 integer :: num_rad ! pixel number in file
138 integer :: nchan ! channel number of each pixel
139 integer , pointer :: ichan(:) ! index of nchan channels
140 integer :: nemis ! emissivity number of each pixel
141 ! may be different with nchan
142 ! due to polarisation in microwave
143 integer :: nlevel_fix ! fixed pressure level number for RTM
144 ! e.g., 43 for RTTOV8_5
145 real , pointer :: pres(:) ! pressure with nlevel_fix
146 integer :: nlevel_cld ! cloud profile level number for RTM
147 end type rad_header_type
149 type rad_data_type ! innovation file pixel data
151 ! part from Observation
152 integer :: landmask ! 1:land; 0:sea
153 integer :: scanline ! number of scan line
154 integer :: scanpos ! number of scan position
155 real :: lat ! Latitude in degree
156 real :: lon ! Longitude in degree
157 real :: elv ! Elevation in m
158 real :: satzen ! satellite zenith angle in degree
159 real :: satazi ! satellite azimuth angle in degree
160 real :: solzen ! solar zenith angle in degree
161 real :: solazi ! solar azimuth angle in degree
162 real, pointer :: tb(:) ! observed brightness temperatures in Kelvin
163 real, pointer :: inv(:) ! innovation (obs - background) in Kelvin
164 real, pointer :: bias(:) ! bias correction values in Kelvin
165 real, pointer :: err(:) ! std of observation error in Kelvin
166 real, pointer :: qc(:) ! quality control flag
167 ! 0:good; <0:rejected; other:suspected
168 real, pointer :: emiss(:) ! surface emissivity
170 ! part from background field
171 integer :: surftype ! surface type
172 ! 0:sea 1:sea-ice 2:land 3:snow
173 ! 4:mix-sea 5:mix-sea-ice 6:mix-land 7:mix-snow
174 integer :: terrain ! model terrain in m
175 integer :: soiltyp ! soil type (MM5/WRF USGS 24 catagories)
176 integer :: vegtyp ! vegetation type (MM5/WRF 16 catagories)
177 real :: vegfra ! vegetation fraction
178 real :: soilm ! soil moisture
179 real :: soilt ! soil temperature
180 real :: snowh ! snow depth
181 real :: ps ! surface pressure in hPa
182 real :: ts ! surface skin temperature in Kelvin
183 real :: t2m ! T in Kelvin at 2m
184 real :: mr2m ! volume mixture ratio in ppmv at 2m
185 real :: u10,v10 ! u/v wind in m/s at 10m
186 real, pointer :: t(:) ! temperatures at fixed pressure levels
187 real, pointer :: mr(:) ! volume mixture ratio in ppmv at fixed pressure levels
188 real, pointer :: zk(:) ! vertical interpolation weight from model level to fixed pressure levels
189 real, pointer :: pm(:) ! full-level pressure at model levels
190 real, pointer :: phm(:) ! half-level pressure at model levels
191 real, pointer :: tm(:) ! temperatures at model levels
192 real, pointer :: cc(:) ! cloud cover at model levels
193 real, pointer :: rain(:) ! rainfall rate in kg/m2/s
194 real, pointer :: solidp(:) ! solid precipitation rate in kg/m2/s
195 real, pointer :: clw(:) ! cloud liquid water (kg/kg)
196 real, pointer :: ciw(:) ! cloud ice water (kg/kg)
197 integer, pointer :: cloudflag(:) ! cloud flag
199 end type rad_data_type
201 type bias_type
202 integer :: nchan ! number of channels
203 integer :: npred ! number of predictors
204 integer :: platform_id,satellite_id,sensor_id
205 integer :: year, month, day, hour, min, sec
206 integer :: scanline,scanpos
207 integer :: landmask
208 integer, pointer :: qc_flag(:) ! 1/0:good/bad
209 integer, pointer :: cloud_flag(:) ! 1/0:no-cloud/cloud
210 integer :: surf_flag ! surface type
211 real :: elevation,lat,lon,ps, t2m, q2m, tsk, clwp
212 real, pointer :: tb(:), omb(:), bias(:)
213 real, pointer :: pred(:)
214 end type bias_type
216 integer, allocatable :: num_tovs_before(:,:)
217 integer, allocatable :: num_tovs_after(:,:)
218 integer, allocatable :: tovs_send_pe(:,:)
219 integer, allocatable :: tovs_send_start(:,:)
220 integer, allocatable :: tovs_send_count(:,:)
221 integer, allocatable :: tovs_recv_pe(:,:)
222 integer, allocatable :: tovs_recv_start(:,:)
223 integer, allocatable :: tovs_copy_count(:)
225 contains
227 #include "da_jo_and_grady_rad.inc"
228 #include "da_residual_rad.inc"
229 #include "da_biascorr.inc"
230 #include "da_read_biascoef.inc"
231 #include "da_biasprep.inc"
232 #include "da_write_biasprep.inc"
233 #ifdef RTTOV
234 #include "da_predictor_rttov.inc"
235 #endif
236 #ifdef CRTM
237 #include "da_predictor_crtm.inc"
238 #include "da_qc_crtm.inc"
239 #endif
240 #include "da_cloud_sim.inc"
241 #include "da_cloud_detect.inc"
242 #include "da_qc_airs.inc"
243 #include "da_qc_amsua.inc"
244 #include "da_qc_amsub.inc"
245 #include "da_qc_hirs.inc"
246 #include "da_qc_ssmis.inc"
247 #include "da_qc_iasi.inc"
248 #include "da_qc_mhs.inc"
249 #include "da_qc_mwts.inc"
250 #include "da_qc_mwhs.inc"
251 #include "da_qc_mwhs2.inc"
252 #include "da_qc_atms.inc"
253 #include "da_qc_seviri.inc"
254 #include "da_qc_amsr2.inc"
255 #include "da_qc_ahi.inc"
256 #include "da_qc_gmi.inc"
257 #include "da_qc_goesimg.inc"
258 #include "da_qc_goesabi.inc"
259 #include "da_write_iv_rad_ascii.inc"
260 #include "da_write_iv_rad_for_multi_inc.inc"
261 #include "da_read_iv_rad_for_multi_inc.inc"
262 #include "da_write_oa_rad_ascii.inc"
263 #include "da_detsurtyp.inc"
264 #include "da_cld_eff_radius.inc"
265 #include "da_ao_stats_rad.inc"
266 #include "da_oi_stats_rad.inc"
267 #include "da_print_stats_rad.inc"
268 #include "da_qc_rad.inc"
269 #include "da_setup_satcv.inc"
270 #include "da_mspps_emis.inc"
271 #include "da_mspps_ts.inc"
273 #endif
275 end module da_radiance1