1 subroutine da_get_var_diagnostics( iv, j)
3 !-----------------------------------------------------------------------
5 !-----------------------------------------------------------------------
9 type(iv_type), intent(inout):: iv ! innovation vector.
10 type(j_type), intent(inout) :: j ! Cost function.
12 integer :: num_stats_tot
17 if (trace_use) call da_trace_entry("da_get_var_diagnostics")
19 !--------------------------------------------------------------------------
20 ! [1.0] Sum up Jo across processors:
21 !--------------------------------------------------------------------------
23 num_stats_tot = sum(iv%nstats(:))
25 temp(1) = j % jo % synop_u
26 temp(2) = j % jo % synop_v
27 temp(3) = j % jo % synop_t
28 temp(4) = j % jo % synop_p
29 temp(5) = j % jo % synop_q
30 temp(6) = j % jo % metar_u
31 temp(7) = j % jo % metar_v
32 temp(8) = j % jo % metar_t
33 temp(9) = j % jo % metar_p
34 temp(10) = j % jo % metar_q
35 temp(11) = j % jo % ships_u
36 temp(12) = j % jo % ships_v
37 temp(13) = j % jo % ships_t
38 temp(14) = j % jo % ships_p
39 temp(15) = j % jo % ships_q
40 temp(16) = j % jo % geoamv_u
41 temp(17) = j % jo % geoamv_v
42 temp(18) = j % jo % polaramv_u
43 temp(19) = j % jo % polaramv_v
44 temp(20) = j % jo % gpspw_tpw
45 temp(21) = j % jo % gpsref_ref
46 temp(22) = j % jo % sound_u
47 temp(23) = j % jo % sound_v
48 temp(24) = j % jo % sound_t
49 temp(25) = j % jo % sound_q
50 temp(26) = j % jo % sonde_sfc_u
51 temp(27) = j % jo % sonde_sfc_v
52 temp(28) = j % jo % sonde_sfc_t
53 temp(29) = j % jo % sonde_sfc_p
54 temp(30) = j % jo % sonde_sfc_q
55 temp(31) = j % jo % airep_u
56 temp(32) = j % jo % airep_v
57 temp(33) = j % jo % airep_t
58 temp(34) = j % jo % pilot_u
59 temp(35) = j % jo % pilot_v
60 temp(36) = j % jo % bogus_u
61 temp(37) = j % jo % bogus_v
62 temp(38) = j % jo % bogus_t
63 temp(39) = j % jo % bogus_q
64 temp(40) = j % jo % bogus_slp
65 temp(41) = j % jo % ssmir_speed
66 temp(42) = j % jo % ssmir_tpw
67 temp(43) = j % jo % ssmi_tb19v
68 temp(44) = j % jo % ssmi_tb19h
69 temp(45) = j % jo % ssmi_tb22v
70 temp(46) = j % jo % ssmi_tb37v
71 temp(47) = j % jo % ssmi_tb37h
72 temp(48) = j % jo % ssmi_tb85v
73 temp(49) = j % jo % ssmi_tb85h
74 temp(50) = j % jo % satem_thickness
75 temp(51) = j % jo % ssmt1_t
76 temp(52) = j % jo % ssmt2_rh
77 temp(53) = j % jo % qscat_u
78 temp(54) = j % jo % qscat_v
79 temp(55) = j % jo % profiler_u
80 temp(56) = j % jo % profiler_v
81 temp(57) = j % jo % buoy_u
82 temp(58) = j % jo % buoy_v
83 temp(59) = j % jo % buoy_t
84 temp(60) = j % jo % buoy_p
85 temp(61) = j % jo % buoy_q
86 temp(62) = j % jo % airsr_t
87 temp(63) = j % jo % airsr_q
88 temp(64) = j % jo % mtgirs_t
89 temp(65) = j % jo % mtgirs_q
90 temp(66) = j % jo % mtgirs_u
91 temp(67) = j % jo % mtgirs_v
92 temp(68) = j % jo % tamdar_t
93 temp(69) = j % jo % tamdar_q
94 temp(70) = j % jo % tamdar_u
95 temp(71) = j % jo % tamdar_v
96 temp(72) = j % jo % tamdar_sfc_u
97 temp(73) = j % jo % tamdar_sfc_v
98 temp(74) = j % jo % tamdar_sfc_t
99 temp(75) = j % jo % tamdar_sfc_p
100 temp(76) = j % jo % tamdar_sfc_q
103 call da_proc_sum_real(temp(:))
105 j % jo % synop_u = temp(1)
106 j % jo % synop_v = temp(2)
107 j % jo % synop_t = temp(3)
108 j % jo % synop_p = temp(4)
109 j % jo % synop_q = temp(5)
110 j % jo % metar_u = temp(6)
111 j % jo % metar_v = temp(7)
112 j % jo % metar_t = temp(8)
113 j % jo % metar_p = temp(9)
114 j % jo % metar_q = temp(10)
115 j % jo % ships_u = temp(11)
116 j % jo % ships_v = temp(12)
117 j % jo % ships_t = temp(13)
118 j % jo % ships_p = temp(14)
119 j % jo % ships_q = temp(15)
120 j % jo % geoamv_u = temp(16)
121 j % jo % geoamv_v = temp(17)
122 j % jo % polaramv_u = temp(18)
123 j % jo % polaramv_v = temp(19)
124 j % jo % gpspw_tpw = temp(20)
125 j % jo % gpsref_ref = temp(21)
126 j % jo % sound_u = temp(22)
127 j % jo % sound_v = temp(23)
128 j % jo % sound_t = temp(24)
129 j % jo % sound_q = temp(25)
130 j % jo % sonde_sfc_u = temp(26)
131 j % jo % sonde_sfc_v = temp(27)
132 j % jo % sonde_sfc_t = temp(28)
133 j % jo % sonde_sfc_p = temp(29)
134 j % jo % sonde_sfc_q = temp(30)
135 j % jo % airep_u = temp(31)
136 j % jo % airep_v = temp(32)
137 j % jo % airep_t = temp(33)
138 j % jo % pilot_u = temp(34)
139 j % jo % pilot_v = temp(35)
140 j % jo % bogus_u = temp(36)
141 j % jo % bogus_v = temp(37)
142 j % jo % bogus_t = temp(38)
143 j % jo % bogus_q = temp(39)
144 j % jo % bogus_slp = temp(40)
145 j % jo % ssmir_speed = temp(41)
146 j % jo % ssmir_tpw = temp(42)
147 j % jo % ssmi_tb19v = temp(43)
148 j % jo % ssmi_tb19h = temp(44)
149 j % jo % ssmi_tb22v = temp(45)
150 j % jo % ssmi_tb37v = temp(46)
151 j % jo % ssmi_tb37h = temp(47)
152 j % jo % ssmi_tb85v = temp(48)
153 j % jo % ssmi_tb85h = temp(49)
154 j % jo % satem_thickness = temp(50)
155 j % jo % ssmt1_t = temp(51)
156 j % jo % ssmt2_rh = temp(52)
157 j % jo % qscat_u = temp(53)
158 j % jo % qscat_v = temp(54)
159 j % jo % profiler_u = temp(55)
160 j % jo % profiler_v = temp(56)
161 j % jo % buoy_u = temp(57)
162 j % jo % buoy_v = temp(58)
163 j % jo % buoy_t = temp(59)
164 j % jo % buoy_p = temp(60)
165 j % jo % buoy_q = temp(61)
166 j % jo % airsr_t = temp(62)
167 j % jo % airsr_q = temp(63)
169 j % jo % mtgirs_t = temp(64)
170 j % jo % mtgirs_q = temp(65)
171 j % jo % mtgirs_u = temp(66)
172 j % jo % mtgirs_v = temp(67)
174 j % jo % tamdar_t = temp(68)
175 j % jo % tamdar_q = temp(69)
176 j % jo % tamdar_u = temp(70)
177 j % jo % tamdar_v = temp(71)
178 j % jo % tamdar_sfc_u = temp(72)
179 j % jo % tamdar_sfc_v = temp(73)
180 j % jo % tamdar_sfc_t = temp(74)
181 j % jo % tamdar_sfc_p = temp(75)
182 j % jo % tamdar_sfc_q = temp(76)
186 do i = 1, iv%num_inst ! loop for sensor
187 call da_proc_sum_ints(j % jo % rad(i)% num_ichan(:))
188 call da_proc_sum_real(j % jo % rad(i) % jo_ichan(:))
189 jo_radiance = jo_radiance + sum(j % jo % rad(i) % jo_ichan(:))
193 !-----------------------------------------------------------------------------
194 ! [2.0] Print out VAR diagnostics:
195 !-----------------------------------------------------------------------------
199 write(unit=stdout,fmt=*) ' '
200 write(unit=stdout,fmt='(A)') 'Diagnostics'
201 write(unit=stdout,fmt='(A,F12.2)') ' Final cost function J = ', j % total
202 write(unit=stdout,fmt=*) ' '
204 write(unit=stdout,fmt='(a,i8)') ' Total number of obs. = ', num_stats_tot
205 write(unit=stdout,fmt='(a,f15.5)') ' Final value of J = ', j % total
206 write(unit=stdout,fmt='(a,f15.5)') ' Final value of Jo = ', j % jo % total
207 write(unit=stdout,fmt='(a,f15.5)') ' Final value of Jb = ', j % jb
208 write(unit=stdout,fmt='(a,f15.5)') ' Final value of Jc = ', j % jc
209 write(unit=stdout,fmt='(a,f15.5)') ' Final value of Je = ', j % je
210 write(unit=stdout,fmt='(a,f15.5)') ' Final value of Jp = ', j % jp
211 if (num_stats_tot > 0) &
212 write(unit=stdout,fmt='(a,f15.5)') ' Final J / total num_obs = ', j % total / &
214 if (cv_options /= 3) then
215 write(unit=stdout,fmt='(a,(5f15.5))') ' Jb factor used(1) = ', var_scaling1
216 write(unit=stdout,fmt='(a,(5f15.5))') ' Jb factor used(2) = ', var_scaling2
217 write(unit=stdout,fmt='(a,(5f15.5))') ' Jb factor used(3) = ', var_scaling3
218 write(unit=stdout,fmt='(a,(5f15.5))') ' Jb factor used(4) = ', var_scaling4
219 write(unit=stdout,fmt='(a,(5f15.5))') ' Jb factor used(5) = ', var_scaling5
222 write(unit=stdout,fmt='(a, f15.5)') ' Jb factor used = ', jb_factor
223 write(unit=stdout,fmt='(a, f15.5)') ' Je factor used = ', je_factor
224 write(unit=stdout,fmt='(a, f15.5)') ' VarBC factor used = ', varbc_factor
225 write(unit=stdout,fmt=*) ' '
228 write(unit=stdout,fmt='(a,i8)') ' Total number of radiances = ', iv%nstats(radiance)
229 write(unit=stdout,fmt='(a,f15.5)') ' Cost function for radiances = ', jo_radiance
230 write(unit=stdout,fmt=*) ' '
233 ! [4.2] Output components of Jo:
235 if (iv%info(synop)%ntotal > 0) then
236 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' synop obs, Jo(actual) = ', &
237 iv%info(synop)%ntotal, iv%nstats(synop), &
238 j % jo % synop_u, iv % synop_ef_u, &
239 j % jo % synop_v, iv % synop_ef_v, &
240 j % jo % synop_t, iv % synop_ef_t, &
241 j % jo % synop_p, iv % synop_ef_p, &
242 j % jo % synop_q, iv % synop_ef_q
246 if (trace_use) call da_trace("da_get_var_diagnostics", &
247 message="Memory increase from internal write")
249 if (iv%info(metar)%ntotal > 0) then
250 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' metar obs, Jo(actual) = ', &
251 iv%info(metar)%ntotal, iv%nstats(metar), &
252 j % jo % metar_u, iv % metar_ef_u, &
253 j % jo % metar_v, iv % metar_ef_v, &
254 j % jo % metar_t, iv % metar_ef_t, &
255 j % jo % metar_p, iv % metar_ef_p, &
256 j % jo % metar_q, iv % metar_ef_q
259 if (iv%info(ships)%ntotal > 0) then
260 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' ships obs, Jo(actual) = ', &
261 iv%info(ships)%ntotal, iv%nstats(ships), &
262 j % jo % ships_u, iv % ships_ef_u, &
263 j % jo % ships_v, iv % ships_ef_v, &
264 j % jo % ships_t, iv % ships_ef_t, &
265 j % jo % ships_p, iv % ships_ef_p, &
266 j % jo % ships_q, iv % ships_ef_q
270 if (iv%info(geoamv)%ntotal > 0) then
271 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' geoamv ob, Jo(actual) = ', &
272 iv%info(geoamv)%ntotal, iv%nstats(geoamv), &
273 j % jo % geoamv_u, iv % geoamv_ef_u, &
274 j % jo % geoamv_v, iv % geoamv_ef_v, &
275 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
278 if (iv%info(polaramv)%ntotal > 0) then
279 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' polaramv, Jo(actual) = ', &
280 iv%info(polaramv)%ntotal, iv%nstats(polaramv), &
281 j % jo % polaramv_u, iv % polaramv_ef_u, &
282 j % jo % polaramv_v, iv % polaramv_ef_v, &
283 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
287 if (iv%info(gpspw)%ntotal > 0) then
288 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' gpspw obs, Jo(actual) = ', &
289 iv%info(gpspw)%ntotal, iv%nstats(gpspw), &
290 j % jo % gpspw_tpw, iv % gpspw_ef_tpw, &
291 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
294 if (iv%info(gpsref)%ntotal > 0) then
295 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' gpsref obs, Jo(actual) = ', &
296 iv%info(gpsref)%ntotal, iv%nstats(gpsref), &
297 j % jo % gpsref_ref, iv % gpsref_ef_ref, &
298 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
301 if (iv%info(sound)%ntotal > 0) then
302 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' sound obs, Jo(actual) = ', &
303 iv%info(sound)%ntotal, iv%nstats(sound), &
304 j % jo % sound_u, iv % sound_ef_u, &
305 j % jo % sound_v, iv % sound_ef_v, &
306 j % jo % sound_t, iv % sound_ef_t, &
307 j % jo % sound_q, iv % sound_ef_q, 0.0, 1.0
308 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' sonde obs, Jo(actual) = ', &
309 iv%info(sonde_sfc)%ntotal, iv%nstats(sonde_sfc), &
310 j % jo % sonde_sfc_u, iv % synop_ef_u, &
311 j % jo % sonde_sfc_v, iv % synop_ef_v, &
312 j % jo % sonde_sfc_t, iv % synop_ef_t, &
313 j % jo % sonde_sfc_p, iv % synop_ef_p, &
314 j % jo % sonde_sfc_q, iv % synop_ef_q
317 if (iv%info(mtgirs)%ntotal > 0) then
318 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' mtgirs obs, Jo(actual) = ', &
319 iv%info(mtgirs)%ntotal, iv%nstats(mtgirs), &
320 j % jo % mtgirs_u, iv % mtgirs_ef_u, &
321 j % jo % mtgirs_v, iv % mtgirs_ef_v, &
322 j % jo % mtgirs_t, iv % mtgirs_ef_t, &
323 j % jo % mtgirs_q, iv % mtgirs_ef_q, 0.0, 1.0
326 if (iv%info(tamdar)%ntotal > 0) then
327 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' tamdar obs, Jo(actual) = ', &
328 iv%info(tamdar)%ntotal, iv%nstats(tamdar), &
329 j % jo % tamdar_u, iv % tamdar_ef_u, &
330 j % jo % tamdar_v, iv % tamdar_ef_v, &
331 j % jo % tamdar_t, iv % tamdar_ef_t, &
332 j % jo % tamdar_q, iv % tamdar_ef_q, 0.0, 1.0
333 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')'tamdar sfc obs,Jo(actual) = ', &
334 iv%info(tamdar)%ntotal, iv%nstats(tamdar), &
335 j % jo % tamdar_sfc_u, iv % tamdar_sfc_ef_u, &
336 j % jo % tamdar_sfc_v, iv % tamdar_sfc_ef_v, &
337 j % jo % tamdar_sfc_t, iv % tamdar_sfc_ef_t, &
338 j % jo % tamdar_sfc_p, iv % tamdar_sfc_ef_p, &
339 j % jo % tamdar_sfc_q, iv % tamdar_sfc_ef_q
342 if (iv%info(airep)%ntotal > 0) then
343 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' airep obs, Jo(actual) = ', &
344 iv%info(airep)%ntotal, iv%nstats(airep), &
345 j % jo % airep_u, iv % airep_ef_u, &
346 j % jo % airep_v, iv % airep_ef_v, &
347 j % jo % airep_t, iv % airep_ef_t, &
351 if (iv%info(bogus)%ntotal > 0) then
352 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' bogus obs, Jo(actual) = ', &
353 iv%info(bogus)%ntotal, iv%nstats(bogus), &
354 j % jo % bogus_u, iv % bogus_ef_u, &
355 j % jo % bogus_v, iv % bogus_ef_v, &
356 j % jo % bogus_t, iv % bogus_ef_t, &
357 j % jo % bogus_q, iv % bogus_ef_q, &
358 j % jo % bogus_slp, iv % bogus_ef_slp
361 if (iv%info(pilot)%ntotal > 0) then
362 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' pilot obs, Jo(actual) = ', &
363 iv%info(pilot)%ntotal, iv%nstats(pilot), &
364 j % jo % pilot_u, iv % pilot_ef_u, &
365 j % jo % pilot_v, iv % pilot_ef_v, &
366 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
369 if (iv%info(ssmi_rv)%ntotal > 0) then
370 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' ssmir obs, Jo(actual) = ', &
371 iv%info(ssmi_rv)%ntotal, iv%nstats(ssmi_rv), &
372 j % jo % ssmir_speed, iv % ssmir_ef_speed, &
373 j % jo % ssmir_tpw, iv % ssmir_ef_tpw, &
374 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
377 if (iv%info(satem)%ntotal > 0) then
378 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' satem obs, Jo(actual) = ', &
379 iv%info(satem)%ntotal, iv%nstats(satem), &
380 j % jo % satem_thickness, iv % satem_ef_thickness, &
381 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
384 if (iv%info(ssmt1)%ntotal > 0) then
385 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' ssmt1 obs, Jo(actual) = ', &
386 iv%info(ssmt1)%ntotal, iv%nstats(ssmt1), &
387 j % jo % ssmt1_t, iv % ssmt1_ef_t, &
388 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
391 if (iv%info(ssmt2)%ntotal > 0) then
392 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' ssmt2 obs, Jo(actual) = ', &
393 iv%info(ssmt2)%ntotal, iv%nstats(ssmt2), &
394 j % jo % ssmt2_rh, iv % ssmt2_ef_rh, &
395 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
398 if (iv%info(qscat)%ntotal > 0) then
399 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' qscat obs, Jo(actual) = ', &
400 iv%info(qscat)%ntotal, iv%nstats(qscat), &
401 j % jo % qscat_u, iv % qscat_ef_u, &
402 j % jo % qscat_v, iv % qscat_ef_v, &
403 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
406 if (iv%info(buoy)%ntotal > 0) then
407 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' buoy obs, Jo(actual) = ', &
408 iv%info(buoy)%ntotal, iv%nstats(buoy), &
409 j % jo % buoy_u, iv % buoy_ef_u, &
410 j % jo % buoy_v, iv % buoy_ef_v, &
411 j % jo % buoy_t, iv % buoy_ef_t, &
412 j % jo % buoy_p, iv % buoy_ef_p, &
413 j % jo % buoy_q, iv % buoy_ef_q
416 if (iv%info(profiler)%ntotal > 0) then
417 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' profiler, Jo(actual) = ', &
418 iv%info(profiler)%ntotal, iv%nstats(profiler), &
419 j % jo % profiler_u, iv % profiler_ef_u, &
420 j % jo % profiler_v, iv % profiler_ef_v, &
421 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
423 if (iv%info(airsr)%ntotal > 0) then
424 write(unit=jo_unit,fmt='(a30,2i8,10f15.5)')' airsr obs, Jo(actual) = ', &
425 iv%info(airsr)%ntotal, iv%nstats(airsr), &
426 j % jo % airsr_t, iv % airsr_ef_t, &
427 j % jo % airsr_q, iv % airsr_ef_q, &
428 0.0, 1.0, 0.0, 1.0, 0.0, 1.0
430 do i = 1, iv%num_inst ! loop for sensor
431 do k = 1, iv%instid(i)%nchan
432 if (j % jo % rad(i) % num_ichan(k) > 0) then
433 write(unit=jo_unit,fmt='(a30,a16,i5,i10,8f15.5)')' radiance, Jo(actual) = ', &
434 iv%instid(i)%rttovid_string, iv%instid(i)%ichan(k) , &
435 j % jo % rad(i) % num_ichan(k), &
436 j % jo % rad(i) % jo_ichan(k)
442 if (trace_use) call da_trace_exit("da_get_var_diagnostics")
444 end subroutine da_get_var_diagnostics