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