da_setup_obs_structures_ascii.inc
References to this file elsewhere.
1 subroutine da_setup_obs_structures_ascii( ob, iv, grid )
2
3 !---------------------------------------------------------------------------
4 ! Purpose: Define, allocate and read of observation structure.
5 !---------------------------------------------------------------------------
6
7 implicit none
8
9 type (y_type), intent(out) :: ob ! Observation structure.
10 type (iv_type), intent(inout) :: iv ! O-B structure.
11 type (domain), intent(inout) :: grid ! First guess structure
12
13 character(len=filename_len) :: filename
14 integer :: n, i, j, k
15
16 if (trace_use) call da_trace_entry("da_setup_obs_structures_ascii")
17
18 !--------------------------------------------------------------------------
19 ! [1.0] Scan GTS observation header and get idea of number of obs:
20 !--------------------------------------------------------------------------
21
22 if (num_fgat_time > 1) then
23 filename = ' '
24
25 do n=1, num_fgat_time
26 iv%time = n
27
28 write(filename(1:10), fmt='(a, i2.2,a)') 'ob', n,'.ascii'
29
30 ! scan main body of gts observation file
31 call da_scan_obs_ascii (iv, filename)
32
33 if (use_ssmiretrievalobs .or. use_ssmitbobs) then
34 ! scan SSMI observation file
35 write(filename(1:10), fmt='(a, i2.2,a)') 'ob', n,'.ssmi'
36 call da_scan_obs_ssmi (iv, filename)
37 end if
38
39 if (use_radarobs) then
40 ! scan radar observation file
41 write(filename(1:10), fmt='(a, i2.2,a)') 'ob', n,'.radar'
42 call da_scan_obs_radar(iv, filename)
43 end if
44 iv%info(:)%plocal(n) = iv%info(:)%nlocal
45 iv%info(:)%ptotal(n) = iv%info(:)%ntotal
46 end do
47 else
48 iv%time = 1
49
50 call da_scan_obs_ascii(iv, 'ob01.ascii')
51
52 !-----------------------------------------------------------------------
53 ! read header of ssmi observation file
54 !-----------------------------------------------------------------------
55 if (use_ssmiretrievalobs .or. use_ssmitbobs) then
56 call da_scan_obs_ssmi(iv, 'ob01.ssmi')
57 end if
58
59 ! scan main body of radar observation file
60 if (use_radarobs) then
61 call da_scan_obs_radar(iv, 'ob01.radar')
62 end if
63 do i=1,num_ob_indexes
64 iv%info(i)%plocal(iv%time) = iv%info(i)%nlocal
65 iv%info(i)%ptotal(iv%time) = iv%info(i)%ntotal
66 end do
67 end if
68
69 !--------------------------------------------------------------------------
70 ! Allocate the ob based on input number of obs:
71 !--------------------------------------------------------------------------
72
73 call da_allocate_observations (iv)
74
75 if (num_fgat_time > 1) then
76 do n=1, num_fgat_time
77 iv%time = n
78
79 write(filename(1:10), fmt='(a, i2.2,a)') 'ob', n,'.ascii'
80
81 ! Read gts observation file
82 call da_read_obs_ascii (iv, filename)
83
84 if (use_ssmiretrievalobs .or. use_ssmitbobs) then
85 ! read ssmi observation file
86 write(filename(1:10), fmt='(a, i2.2)') 'ob', n,'.ssmi'
87 call da_read_obs_ssmi (iv, filename)
88 end if
89
90 if (use_radarobs) then
91 ! read radar observation file
92 write(filename(1:11), fmt='(a, i2.2)') 'ob', n,'.radar'
93 call da_read_obs_radar(iv, filename)
94 end if
95 end do
96 else
97 iv%time = 1
98
99 call da_read_obs_ascii(iv, 'ob01.ascii')
100
101 if (use_ssmiretrievalobs .or. use_ssmitbobs) then
102 ! read ssmi observation file
103 call da_read_obs_ssmi (iv, 'ob01.ssmi')
104 end if
105
106 if (use_radarobs) then
107 ! read radar observation file
108 call da_read_obs_radar(iv, 'ob01.radar')
109 end if
110 end if
111
112 ! Calculate DT for RF DA
113
114 if (use_radarobs .and. use_radar_rf) then
115 if (.not. DT_cloud_model) then
116 do j = jts,jte
117 do i = its, ite
118 do k = kts, kte
119 grid%xb%delt(i,j,k) = 0.0
120 end do
121 end do
122 end do
123
124 do n = 1, iv%info(radar)%nlocal
125 do i=int(iv%info(radar)%i(1,n)), int(iv%info(radar)%i(1,n))+1
126 do j=int(iv%info(radar)%j(1,n)), int(iv%info(radar)%j(1,n))+1
127 do k=kts, kte
128 grid%xb%delt(i,j,k) = 1800.0
129 grid%xb%qrn(i,j,k) = amax1(5.0E-5, grid%xb%qrn(i,j,k))
130 grid%xb%qcw(i,j,k) = amax1(5.0E-12, grid%xb%qcw(i,j,k))
131 end do
132 ! do k=kts, kte
133 ! v_h(k)=grid%xb%h(i,j ,k)
134 ! end do
135 ! do k = 1, iv%info(radar)%levels(n)
136 ! call zk(iv%radar(n)%height(k), v_h, zkk)
137 ! grid%xb%delt(i,j,int(zkk))=1800.0
138 ! grid%xb%delt(i,j,int(zkk)+1)=1800.0
139 ! end do
140 end do
141 end do
142 end do
143 end if
144 end if
145
146 !--------------------------------------------------------------------------
147 ! [3.0] Calculate innovation vector (O-B) and create (smaller) ob structure:
148 !--------------------------------------------------------------------------
149
150 call da_fill_obs_structures(iv, ob)
151
152 iv%time = 1
153
154 if (trace_use) call da_trace_exit("da_setup_obs_structures_ascii")
155
156 end subroutine da_setup_obs_structures_ascii
157
158