1 subroutine da_read_simulated_rad (iv)
3 !---------------------------------------------------------------------------
4 ! Purpose: Generate simulated radiances for every model grid point and
9 ! HISTORY: 12/12/2008 - Creation Tom Auligne
10 !---------------------------------------------------------------------------
16 type (iv_type), intent (inout) :: iv
18 ! Instrument triplet, follow the convension of RTTOV
19 integer :: platform_id, satellite_id, sensor_id
21 type (datalink_type) :: p
23 logical :: outside, outside_all
24 integer :: i,j,k,nchan,inst, alloc_stat
25 type(info_type) :: info
26 type(model_loc_type) :: loc
28 call da_trace_entry("da_read_simulated_rad")
30 ! Initialize variables
32 platform_id = pseudo_rad_platid
33 satellite_id = pseudo_rad_satid
34 sensor_id = pseudo_rad_senid
35 if (sensor_id == 0) then
37 else if (sensor_id == 1) then
39 else if (sensor_id == 3) then
41 else if (sensor_id == 4) then
43 else if (sensor_id == 15) then
45 else if (sensor_id == 10) then
47 else if (sensor_id == 11) then
51 inst = 1 ! single instrument
53 iv%info(radiance)%ntotal = (ide - ids + 1) * (jde - jds + 1)
54 iv%info(radiance)%nlocal = (min(ipe+simulated_rad_ngrid,ide) - max(ips-simulated_rad_ngrid,ids) + 1) * &
55 (min(jpe+simulated_rad_ngrid,jde) - max(jps-simulated_rad_ngrid,jds) + 1)
56 iv%info(radiance)%ptotal(1) = iv%info(radiance)%ntotal
57 iv%instid(inst)%num_rad = iv%info(radiance)%nlocal
58 iv%instid(inst)%info%nlocal = iv%info(radiance)%nlocal
60 ! 5.0 allocate innovation radiance structure
61 !----------------------------------------------------------------
63 if ( iv%instid(inst)%num_rad > 0 ) then
65 if (rtm_option == rtm_option_crtm) then
66 iv%instid(inst)%nlevels = kme-kms+1
67 iv%instid(inst)%nchannels=nchan
71 if (rtm_option == rtm_option_rttov) then
72 call rttov_setupchan(inst, nchan, coefs(inst), & ! in
73 iv%instid(inst)%nfrequencies,iv%instid(inst)%nchannels, &
74 iv%instid(inst)%nbtout) ! out
78 call da_allocate_rad_iv(inst,nchan,iv)
80 ! 6.0 assign sequential structure to innovation structure
81 !-------------------------------------------------------------
83 allocate (p%tb_inv(1:nchan), stat=alloc_stat)
84 if ( alloc_stat /= 0 ) CALL da_error(__FILE__,__LINE__,(/"error allocating"/))
86 p%info%date_char = "0000-00-00_00:00:00"
92 p%tb_inv(1:nchan) = pseudo_rad_inv
99 if ((i<ips-simulated_rad_ngrid).or.(i>ipe+simulated_rad_ngrid).or. &
100 (j<jps-simulated_rad_ngrid).or.(j>jpe+simulated_rad_ngrid)) cycle
102 call da_xyll(map_info, i*1.0, j*1.0, p%info%lat, p%info%lon)
111 call da_initialize_rad_iv (inst, k, iv, p)
115 iv%instid(inst)%tb_error(:,:) = pseudo_rad_err
116 iv%instid(inst)%tb_qc(:,:) = qc_good
121 write(UNIT=stdout,FMT='(a,i3,2x,a,3x,i10)') &
122 'Allocating space for radiance innov structure', &
123 inst, iv%instid(inst)%rttovid_string, iv%instid(inst)%num_rad
125 call da_trace_exit("da_read_simulated_rad")
127 end subroutine da_read_simulated_rad