da_random_omb_all.inc

References to this file elsewhere.
1 subroutine da_random_omb_all(iv, ob)
2 
3    !-------------------------------------------------------------------------
4    ! Purpose: Allocates observation structure and fills it fro iv.
5    !-------------------------------------------------------------------------
6 
7    implicit none
8 
9    type (ob_type), intent(inout) :: iv   ! Obs and header structure.
10    type (y_type), intent(inout)  :: ob   ! (Smaller) observation structure.
11 
12    integer                       :: n, k ! Loop counters.
13 
14    !----------------------------------------------------------------------
15    ! [1.0] Initialise random number sequence:
16    !----------------------------------------------------------------------
17 
18    call da_random_seed
19    
20    !----------------------------------------------------------------------
21    !  [2.0] Randomize each ob in turn:
22    !----------------------------------------------------------------------
23 
24    ! [2.1] Transfer surface obs:
25 
26    if (iv % num_synop > 0) then
27       do n = 1, iv % num_synop
28          call da_random_omb(iv % synop(n) % u % error, ob % synop(n) % u, &
29                            iv % synop(n) % u % qc, iv % synop(n) % u % inv)
30          call da_random_omb(iv % synop(n) % v % error, ob % synop(n) % v, &
31                            iv % synop(n) % v % qc, iv % synop(n) % v % inv)
32          call da_random_omb(iv % synop(n) % t % error, ob % synop(n) % t, &
33                            iv % synop(n) % t % qc, iv % synop(n) % t % inv )
34          call da_random_omb(iv % synop(n) % p % error, ob % synop(n) % p, &
35                            iv % synop(n) % p % qc, iv % synop(n) % p % inv)
36          call da_random_omb(iv % synop(n) % q % error, ob % synop(n) % q, &
37                            iv % synop(n) % q % qc, iv % synop(n) % q % inv)
38       end do
39    end if
40 
41    ! [2.2] Transfer metar obs:
42 
43    if (iv % num_metar > 0) then
44       do n = 1, iv % num_metar
45          call da_random_omb(iv % metar(n) % u % error, ob % metar(n) % u, &
46                            iv % metar(n) % u % qc, iv % metar(n) % u % inv)
47          call da_random_omb(iv % metar(n) % v % error, ob % metar(n) % v, &
48                            iv % metar(n) % v % qc, iv % metar(n) % v % inv)
49          call da_random_omb(iv % metar(n) % t % error, ob % metar(n) % t, &
50                            iv % metar(n) % t % qc, iv % metar(n) % t % inv)
51          call da_random_omb(iv % metar(n) % p % error, ob % metar(n) % p, &
52                            iv % metar(n) % p % qc, iv % metar(n) % p % inv)
53          call da_random_omb(iv % metar(n) % q % error, ob % metar(n) % q, &
54                            iv % metar(n) % q % qc, iv % metar(n) % q % inv)
55       end do
56    end if
57 
58    ! [2.3] Transfer ships obs:
59 
60    if (iv % num_ships > 0) then
61       do n = 1, iv % num_ships
62          call da_random_omb(iv % ships(n) % u % error, ob % ships(n) % u, &
63                            iv % ships(n) % u % qc, iv % ships(n) % u % inv)
64          call da_random_omb(iv % ships(n) % v % error, ob % ships(n) % v, &
65                            iv % ships(n) % v % qc, iv % ships(n) % v % inv)
66          call da_random_omb(iv % ships(n) % t % error, ob % ships(n) % t, &
67                            iv % ships(n) % t % qc, iv % ships(n) % t % inv)
68          call da_random_omb(iv % ships(n) % p % error, ob % ships(n) % p, &
69                            iv % ships(n) % p % qc, iv % ships(n) % p % inv)
70          call da_random_omb(iv % ships(n) % q % error, ob % ships(n) % q, &
71                            iv % ships(n) % q % qc, iv % ships(n) % q % inv)
72       end do
73    end if
74 
75    ! [2.4.1] Transfer Geo. AMVs Obs:
76 
77    if (iv % num_geoamv > 0) then
78       do n = 1, iv % num_geoamv 
79         do k = 1, iv % geoamv(n) % info % levels
80          call da_random_omb(iv % geoamv(n) % u(k) % error, ob % geoamv(n) % u(k), &
81                            iv % geoamv(n) % u(k) % qc, iv % geoamv(n) % u(k) % inv)
82          call da_random_omb(iv % geoamv(n) % v(k) % error, ob % geoamv(n) % v(k), &
83                            iv % geoamv(n) % v(k) % qc, iv % geoamv(n) % v(k) % inv)
84         end do
85       end do 
86    end if 
87 
88    ! [2.4.2] Transfer Polar  AMVs Obs:
89 
90    if (iv % num_polaramv > 0) then
91       do n = 1, iv % num_polaramv
92         do k = 1, iv % polaramv(n) % info % levels
93          call da_random_omb(iv % polaramv(n) % u(k) % error, ob % polaramv(n) % u(k), &
94                            iv % polaramv(n) % u(k) % qc, iv % polaramv(n) % u(k) % inv)
95          call da_random_omb(iv % polaramv(n) % v(k) % error, ob % polaramv(n) % v(k), &
96                            iv % polaramv(n) % v(k) % qc, iv % polaramv(n) % v(k) % inv)
97         end do
98       end do
99    end if
100 
101    ! [2.5] Transfer gpspw obs:
102 
103    if (iv % num_gpspw > 0) then
104       do n = 1, iv % num_gpspw
105          call da_random_omb(iv % gpspw(n) % tpw % error, ob % gpspw(n) % tpw, &
106                            iv % gpspw(n) % tpw % qc, iv % gpspw(n) % tpw % inv)
107       end do
108    end if
109 
110    ! [2.6] Transfer sonde obs:
111 
112    if (iv % num_sound > 0) then
113       do n = 1, iv % num_sound
114          do k = 1, iv % sound(n) % info % levels
115             call da_random_omb(iv % sound(n) % u(k) % error, ob % sound(n) % u(k), &
116                               iv % sound(n) % u(k) % qc, iv % sound(n) % u(k) % inv)
117             call da_random_omb(iv % sound(n) % v(k) % error, ob % sound(n) % v(k), &
118                               iv % sound(n) % v(k) % qc, iv % sound(n) % v(k) % inv)
119             call da_random_omb(iv % sound(n) % t(k) % error, ob % sound(n) % t(k), &
120                               iv % sound(n) % t(k) % qc, iv % sound(n) % t(k) % inv)
121             call da_random_omb(iv % sound(n) % q(k) % error, ob % sound(n) % q(k), &
122                               iv % sound(n) % q(k) % qc, iv % sound(n) % q(k) % inv)
123          end do
124 
125          call da_random_omb(iv % sonde_sfc(n) % u % error, ob % sonde_sfc(n) % u, &
126                              iv % sonde_sfc(n) % u % qc, iv % sonde_sfc(n) % u % inv)
127          call da_random_omb(iv % sonde_sfc(n) % v % error, ob % sonde_sfc(n) % v, &
128                              iv % sonde_sfc(n) % v % qc, iv % sonde_sfc(n) % v % inv)
129          call da_random_omb(iv % sonde_sfc(n) % t % error, ob % sonde_sfc(n) % t, &
130                              iv % sonde_sfc(n) % t % qc, iv % sonde_sfc(n) % t % inv )
131          call da_random_omb(iv % sonde_sfc(n) % p % error, ob % sonde_sfc(n) % p, &
132                              iv % sonde_sfc(n) % p % qc, iv % sonde_sfc(n) % p % inv)
133          call da_random_omb(iv % sonde_sfc(n) % q % error, ob % sonde_sfc(n) % q, &
134                              iv % sonde_sfc(n) % q % qc, iv % sonde_sfc(n) % q % inv)
135       end do
136    end if
137 
138    ! [2.7] Transfer airep obs:
139 
140    if (iv % num_airep > 0) then
141       do n = 1, iv % num_airep
142          do k = 1, iv % airep(n) % info % levels
143             call da_random_omb(iv % airep(n) % u(k) % error, ob % airep(n) % u(k), &
144                               iv % airep(n) % u(k) % qc, iv % airep(n) % u(k) % inv)
145             call da_random_omb(iv % airep(n) % v(k) % error, ob % airep(n) % v(k), &
146                               iv % airep(n) % v(k) % qc, iv % airep(n) % v(k) % inv)
147             call da_random_omb(iv % airep(n) % t(k) % error, ob % airep(n) % t(k), &
148                               iv % airep(n) % t(k) % qc, iv % airep(n) % t(k) % inv)
149          end do
150       end do
151    end if
152 
153    ! [2.8] Transfer pilot obs:
154 
155    if (iv % num_pilot > 0) then
156       do n = 1, iv % num_pilot
157          do k = 1, iv % pilot(n) % info % levels
158             call da_random_omb(iv % pilot(n) % u(k) % error, ob % pilot(n) % u(k), &
159                               iv % pilot(n) % u(k) % qc, iv % pilot(n) % u(k) % inv)
160             call da_random_omb(iv % pilot(n) % v(k) % error, ob % pilot(n) % v(k), &
161                               iv % pilot(n) % v(k) % qc, iv % pilot(n) % v(k) % inv)
162          end do
163       end do
164    end if
165 
166    ! [2.9] Transfer SSM/I obs:SSMI:
167 
168    if (iv % num_ssmi_retrieval > 0) then
169       do n = 1, iv % num_ssmi_retrieval
170          call da_random_omb(iv % ssmi_retrieval(n) % speed % error, &
171                            ob % ssmi_retrieval(n) % speed, &
172                            iv % ssmi_retrieval(n) % speed % qc, &
173                            iv % ssmi_retrieval(n) % speed % inv)
174          call da_random_omb(iv % ssmi_retrieval(n) % tpw % error, &
175                            ob % ssmi_retrieval(n) % tpw, &
176                            iv % ssmi_retrieval(n) % tpw % qc, &
177                            iv % ssmi_retrieval(n) % tpw % inv)
178       end do
179    end if
180 
181    if (iv % num_ssmi_tb > 0) then
182       do n = 1, iv % num_ssmi_tb
183          call da_random_omb(iv % ssmi_tb(n) % tb19h % error, &
184                            ob % ssmi_tb(n) % tb19h, &
185                            iv % ssmi_tb(n) % tb19h % qc, &
186                            iv % ssmi_tb(n) % tb19h % inv)
187          call da_random_omb(iv % ssmi_tb(n) % tb19v % error, &
188                            ob % ssmi_tb(n) % tb19v, &
189                            iv % ssmi_tb(n) % tb19v % qc, &
190                            iv % ssmi_tb(n) % tb19v % inv)
191          call da_random_omb(iv % ssmi_tb(n) % tb22v % error, &
192                            ob % ssmi_tb(n) % tb22v, &
193                            iv % ssmi_tb(n) % tb22v % qc, &
194                            iv % ssmi_tb(n) % tb22v % inv)
195          call da_random_omb(iv % ssmi_tb(n) % tb37h % error, &
196                            ob % ssmi_tb(n) % tb37h, &
197                            iv % ssmi_tb(n) % tb37h % qc, &
198                            iv % ssmi_tb(n) % tb37h % inv)
199          call da_random_omb(iv % ssmi_tb(n) % tb37v % error, &
200                            ob % ssmi_tb(n) % tb37v, &
201                            iv % ssmi_tb(n) % tb37v % qc, &
202                            iv % ssmi_tb(n) % tb37v % inv)
203          call da_random_omb(iv % ssmi_tb(n) % tb85h % error, &
204                            ob % ssmi_tb(n) % tb85h, &
205                            iv % ssmi_tb(n) % tb85h % qc, &
206                            iv % ssmi_tb(n) % tb85h % inv)
207          call da_random_omb(iv % ssmi_tb(n) % tb85v % error, &
208                            ob % ssmi_tb(n) % tb85v, &
209                            iv % ssmi_tb(n) % tb85v % qc, &
210                            iv % ssmi_tb(n) % tb85v % inv)
211       end do
212    end if
213 
214    ! [2.10] Transfer satem obs:
215 
216    if (iv % num_satem > 0) then
217       do n = 1, iv % num_satem
218          do k = 1, iv % satem(n) % info % levels
219             call da_random_omb(iv % satem(n) % thickness(k) % error, &
220                               ob % satem(n) % thickness(k), &
221                               iv % satem(n) % thickness(k) % qc, &
222                               iv % satem(n) % thickness(k) % inv)
223          end do
224       end do
225    end if
226    
227    ! [2.11] Transfer ssmt1 obs:
228 
229    if (iv % num_ssmt1 > 0) then
230       do n = 1, iv % num_ssmt1
231          do k = 1, iv % ssmt1(n) % info % levels
232             call da_random_omb(iv % ssmt1(n) % t(k) % error, &
233                               ob % ssmt1(n) % t(k), &
234                               iv % ssmt1(n) % t(k) % qc, &
235                               iv % ssmt1(n) % t(k) % inv)
236          end do
237       end do
238    end if
239 
240    ! [2.12] Transfer ssmt2 obs:
241 
242    if (iv % num_ssmt2 > 0) then
243       do n = 1, iv % num_ssmt2
244          do k = 1, iv % ssmt2(n) % info % levels
245             call da_random_omb(iv % ssmt2(n) % rh(k) % error, &
246                               ob % ssmt2(n) % rh(k), &
247                               iv % ssmt2(n) % rh(k) % qc, &
248                               iv % ssmt2(n) % rh(k) % inv)
249          end do
250       end do
251    end if
252    
253    ! [2.13] Transfer scatterometer obs:
254 
255    if (iv % num_qscat > 0) then
256       do n = 1, iv % num_qscat
257          call da_random_omb(iv % qscat(n) % u % error, ob % qscat(n) % u, &
258                            iv % qscat(n) % u % qc, iv % qscat(n) % u % inv)
259          call da_random_omb(iv % qscat(n) % v % error, ob % qscat(n) % v, &
260                            iv % qscat(n) % v % qc, iv % qscat(n) % v % inv)
261       end do
262    end if
263 
264    ! [2.14] Transfer buoy obs:
265 
266    if (iv % num_buoy > 0) then
267       do n = 1, iv % num_buoy
268          call da_random_omb(iv % buoy(n) % u % error, ob % buoy(n) % u, &
269                            iv % buoy(n) % u % qc, iv % buoy(n) % u % inv)
270          call da_random_omb(iv % buoy(n) % v % error, ob % buoy(n) % v, &
271                            iv % buoy(n) % v % qc, iv % buoy(n) % v % inv)
272          call da_random_omb(iv % buoy(n) % t % error, ob % buoy(n) % t, &
273                            iv % buoy(n) % t % qc, iv % buoy(n) % t % inv)
274          call da_random_omb(iv % buoy(n) % p % error, ob % buoy(n) % p, &
275                            iv % buoy(n) % p % qc, iv % buoy(n) % p % inv)
276          call da_random_omb(iv % buoy(n) % q % error, ob % buoy(n) % q, &
277                            iv % buoy(n) % q % qc, iv % buoy(n) % q % inv)
278       end do
279    end if
280 
281    ! [2.15] Transfer profiler obs:
282 
283    if (iv % num_profiler > 0) then
284       do n = 1, iv % num_profiler
285          do k = 1, iv % profiler(n) % info % levels
286             call da_random_omb(iv % profiler(n) % u(k) % error, &
287                ob % profiler(n) % u(k), &
288                iv % profiler(n) % u(k) % qc, iv % profiler(n) % u(k) % inv)
289             call da_random_omb(iv % profiler(n) % v(k) % error, &
290                ob % profiler(n) % v(k), &
291                iv % profiler(n) % v(k) % qc, iv % profiler(n) % v(k) % inv)
292          end do
293       end do
294    end if
295 
296    ! [2.16] Transfer TC bogus obs:
297 
298    if (iv % num_bogus > 0) then
299       do n = 1, iv % num_bogus
300          do k = 1, iv % bogus(n) % info % levels
301             call da_random_omb(iv % bogus(n) % u(k) % error, &
302                ob % bogus(n) % u(k), &
303                iv % bogus(n) % u(k) % qc, iv % bogus(n) % u(k) % inv)
304             call da_random_omb(iv % bogus(n) % v(k) % error, &
305                ob % bogus(n) % v(k), &
306                iv % bogus(n) % v(k) % qc, iv % bogus(n) % v(k) % inv)
307             call da_random_omb(iv % bogus(n) % t(k) % error, &
308                ob % bogus(n) % t(k), &
309                iv % bogus(n) % t(k) % qc, iv % bogus(n) % t(k) % inv)
310             call da_random_omb(iv % bogus(n) % q(k) % error, &
311               ob % bogus(n) % q(k), &
312               iv % bogus(n) % q(k) % qc, iv % bogus(n) % q(k) % inv)
313          end do
314 
315          call da_random_omb(iv % bogus(n) % slp % error, ob % bogus(n) % slp, &
316                             iv % bogus(n) % slp % qc, iv % bogus(n) % slp % inv)
317       end do
318    end if
319 
320    ! Transfer AIRS retrievals:
321 
322    if (iv % num_airsr > 0) then
323       do n = 1, iv % num_airsr
324          do k = 1, iv % airsr(n) % info % levels
325             call da_random_omb(iv % airsr(n) % t(k) % error, &
326                ob % airsr(n) % t(k), &
327                iv % airsr(n) % t(k) % qc, iv % airsr(n) % t(k) % inv)
328             call da_random_omb(iv % airsr(n) % q(k) % error, &
329                ob % airsr(n) % q(k), &
330                iv % airsr(n) % q(k) % qc, iv % airsr(n) % q(k) % inv)
331          end do
332       end do
333    end if
334 
335 end subroutine da_random_omb_all
336 
337