1 subroutine da_setup_radiance_structures( grid, ob, iv )
3 !---------------------------------------------------------------------------
4 ! Purpose: Define, allocate and read of tovs raidance observation structure.
5 !---------------------------------------------------------------------------
9 type (domain) , intent(inout) :: grid ! model data
10 type ( y_type), intent(inout) :: ob ! Observation structure.
11 type (iv_type), intent(inout) :: iv ! O-B structure.
13 character(len=200) :: filename
14 integer :: i, j, n, ios, ifgat
18 integer :: n1,n2,k,its,ite,jts,jte,kts,kte,inst
19 integer :: data_format, iret ! AHI radiance related
20 integer :: ahi_info_unit
22 if (trace_use) call da_trace_entry("da_setup_radiance_structures")
24 !-------------------------------------------------------------------
25 ! [1.0] Initialize RTTOV coefs and innovations vector for radiance
26 !-------------------------------------------------------------------
28 call da_radiance_init(iv, ob)
30 do n = 1, rtminit_nsensor
31 iv%instid(n)%rad_monitoring = rad_monitoring(n)
34 !-------------------------------
35 ! 1.1 Make thinning grids
36 !------------------------------
39 allocate(thinning_grid(iv%num_inst,num_fgat_time))
40 do ifgat=1,num_fgat_time
42 call makegrids (n,thinning_mesh(n),ifgat)
47 !-------------------------------------------------------------------
48 ! [2.0] Read NCEP bufr tovs data in radiance innovations vector
49 !-------------------------------------------------------------------
51 if ( (.not. use_filtered_rad) .and. (.not. use_pseudo_rad) .and. (.not. use_simulated_rad) ) then
53 if (use_hirs2obs) then
54 write(unit=stdout,fmt='(a)') 'Reading radiance 1b data from hirs2.bufr'
56 call da_read_obs_bufrtovs ('hirs2', iv, filename)
60 write(unit=stdout,fmt='(a)') 'Reading radiance 1b data from msu.bufr'
62 call da_read_obs_bufrtovs ('msu ', iv, filename)
65 if (use_hirs3obs) then
66 write(unit=stdout,fmt='(a)') 'Reading radiance 1b data from hirs3.bufr'
68 call da_read_obs_bufrtovs('hirs3', iv, filename)
71 if (use_amsuaobs) then
72 write(unit=stdout,fmt='(a)') 'Reading radiance 1b data from amsua.bufr'
74 call da_read_obs_bufrtovs ('amsua', iv, filename)
77 if (use_amsubobs) then
78 write(unit=stdout,fmt='(a)') 'Reading radiance 1b data from amsub.bufr'
80 call da_read_obs_bufrtovs ('amsub', iv, filename)
83 if (use_hirs4obs) then
84 write(unit=stdout,fmt='(a)') 'Reading radiance 1b data from hirs4.bufr'
86 call da_read_obs_bufrtovs('hirs4', iv, filename)
90 write(unit=stdout,fmt='(a)') 'Reading radiance 1b data from mhs.bufr'
92 call da_read_obs_bufrtovs('mhs ', iv, filename)
96 write(unit=stdout,fmt='(a)') 'Reading radiance 1b data from mwtsa.dat and mwtsb.dat'
98 call da_read_obs_fy3('mwts ', iv, filename)
100 call da_read_obs_fy3('mwts ', iv, filename)
103 if (use_mwhsobs) then
104 write(unit=stdout,fmt='(a)') 'Reading radiance 1b data from mwhsa.dat and mwhsb.dat'
106 call da_read_obs_fy3('mwhs ', iv, filename)
108 call da_read_obs_fy3('mwhs ', iv, filename)
111 if (use_mwhs2obs) then
112 write(unit=stdout,fmt='(a)') 'Reading radiance 1b data from mwhs2.hdf'
114 call da_read_obs_hdf5mwhs2(iv, filename)
117 if (use_atmsobs) then
118 write(unit=stdout,fmt='(a)') 'Reading radiance 1b data from atms.bufr'
120 call da_read_obs_bufratms('atms ', iv, filename)
123 if (use_airsobs) then
124 write(unit=stdout,fmt='(a)') 'Reading airs 1b data from airs.bufr'
126 call da_read_obs_bufrairs ('airs ',iv, filename)
129 if (use_eos_amsuaobs) then
130 write(unit=stdout,fmt='(a)') 'Reading eos_amsua 1b data from airs.bufr'
132 call da_read_obs_bufrairs ('eos_amsua',iv, filename)
136 write(unit=stdout,fmt='(a)') 'Reading hsb 1b data from airs.bufr'
138 call da_read_obs_bufrairs ('hsb ',iv, filename)
141 if (use_ssmisobs) then
142 write(unit=stdout,fmt='(a)') 'Reading ssmis data from ssmis.bufr'
144 call da_read_obs_bufrssmis ('ssmis ',iv, filename)
146 if (use_iasiobs) then
147 write(unit=stdout,fmt='(a)') 'Reading iasi data from iasi.bufr'
149 call da_read_obs_bufriasi ('iasi ',iv, filename)
151 if (use_seviriobs) then
152 write(unit=stdout,fmt='(a)') 'Reading seviri data from seviri.bufr'
154 call da_read_obs_bufrseviri ('seviri ',iv, filename)
156 if (use_amsr2obs) then
158 write(unit=stdout,fmt='(a)') 'Reading AMSR2 data in HDF5 format'
159 call da_read_obs_hdf5amsr2 (iv, 'L1SGRTBR', 'L2SGCLWLD')
161 message(1)='To read AMSR2 data, WRFDA must be compiled with HDF5'
162 call da_error(__FILE__,__LINE__,message(1:1))
166 call da_get_unit(ahi_info_unit)
167 open(unit=ahi_info_unit,file='ahi_info',status='old',iostat=iret)
169 call da_error(__FILE__,__LINE__,(/"Read ahi_info error: no such file"/))
172 !read ahi information
173 read(ahi_info_unit,*)
174 read(ahi_info_unit,*) data_format
176 call da_free_unit(ahi_info_unit)
178 if (data_format==1) then
180 write(unit=stdout,fmt='(a)') 'Reading AHI data from cma hdf5'
181 call da_read_obs_hdf5ahi (iv, 'L1AHITBR', 'L2AHICLP')
183 call da_error(__FILE__,__LINE__,(/"To read AHI data, WRFDA must be compiled with HDF5"/))
186 if (data_format==2) then
187 write(unit=stdout,fmt='(a)') 'Reading AHI data from geocat NETCDF4'
188 call da_read_obs_netcdf4ahi_geocat (iv, 'L1AHITBR', 'L2AHICLP')
190 if (data_format==3) then
191 write(unit=stdout,fmt='(a)') 'Reading AHI data from JAXA NETCDF4'
192 ! call da_read_obs_netcdf4ahi_jaxa (iv, 'L1AHITBR', 'L2AHICLP')
193 call da_read_obs_netcdf4ahi_jaxa (iv, 'L1AHITBR', 'L1AHITBRP')
195 !if (data_format==4) then
197 !call da_read_obs_bufrahi ('ahi ',iv, filename)
200 if (use_goesimgobs) then
201 write(unit=stdout,fmt='(a)') 'Reading netcdf goes imager GVAR data'
202 !if (imager_format==1)then
203 ! write(unit=stdout,fmt='(a)') 'Reading goesimg data from HDF4 files'
204 ! filename = 'HDF4IMAGER-13'
205 ! call da_read_obs_hdf4imager(iv, filename)
206 ! filename = 'HDF4IMAGER-15'
207 ! call da_read_obs_hdf4imager(iv, filename)
209 !if (imager_format==2)then
210 ! write(unit=stdout,fmt='(a)') 'Reading goesimg data from NETCDF files'
211 filename = 'goes-13-imager'
212 call da_read_obs_ncgoesimg(iv, filename)
213 filename = 'goes-14-imager'
214 call da_read_obs_ncgoesimg(iv, filename)
215 filename = 'goes-15-imager'
216 call da_read_obs_ncgoesimg(iv, filename)
218 !write(unit=stdout,fmt='(a)') 'Finish reading goesimg data'
222 write(unit=stdout,fmt='(a)') 'Reading GMI data in HDF5 format'
223 call da_read_obs_hdf5gmi (iv, '1B.GPM.GMI','2A.GPM.GMI')
225 message(1)='To read GMI data, WRFDA must be compiled with HDF5'
226 call da_error(__FILE__,__LINE__,message(1:1))
231 if ( use_filtered_rad ) then
232 write(unit=stdout,fmt='(a)') 'Reading filtered radiance'
233 call da_read_filtered_rad (iv)
236 if ( use_simulated_rad ) then
237 write(unit=stdout,fmt='(a)') 'Reading simulated radiance'
238 call da_read_simulated_rad (iv)
241 if ( use_pseudo_rad ) then
242 write(unit=stdout,fmt='(a)') 'Reading pseudo radiance from namelist'
243 call da_read_pseudo_rad (iv)
246 if (use_kma1dvar) then
247 do i=1,rtminit_nsensor
249 filename='kma1dvar-'//trim(iv%instid(i)%rttovid_string)//'.inv'
250 write(unit=stdout,fmt='(a,a)') ' Reading KMA 1dvar innovation from ', filename
251 call da_read_kma1dvar (i,iv, ob, filename)
256 do ifgat=1,num_fgat_time
258 call destroygrids (n,ifgat)
261 deallocate(thinning_grid)
264 ! sorting obs into FGAT time bins
268 !-----------------------------------------------------------------------------
269 ! [3.0] create (smaller) ob structure:
270 !-----------------------------------------------------------------------------
272 if (.not. use_kma1dvar) then
273 do i = 1, ob % num_inst
274 ob % instid(i) % num_rad = iv % instid(i) % num_rad
275 if (ob % instid(i) % num_rad < 1) cycle
276 allocate (ob % instid(i) % tb(ob % instid(i) % nchan,ob % instid(i)%num_rad))
277 ob % instid(i) % tb(:,:) = iv % instid(i) % tb_inv(:,:)
281 ! Calculate DT for Cloudy Radiance DA
283 if (use_rad .and. crtm_cloud .and. .not. DT_cloud_model) then
291 grid%xb%delt(its:ite,jts:jte,kts:kte) = 0.0
293 do inst= 1, iv % num_inst
294 do n=1,iv%instid(inst)%num_rad
295 i = int(iv%instid(inst)%info%i(1,n))
296 j = int(iv%instid(inst)%info%j(1,n))
297 grid%xb%delt(i:i+1, j:j+1, kts:kte) = 1800.0
302 if (trace_use) call da_trace_exit("da_setup_radiance_structures")
304 end subroutine da_setup_radiance_structures