da_setup_obs_structures_bufr.inc
References to this file elsewhere.
1 subroutine da_setup_obs_structures_bufr(ob, iv)
2
3 !---------------------------------------------------------------------------
4 ! Purpose: Define, allocate and read 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
12 character(len=filename_len) :: filename
13 integer :: n,i
14
15 if (trace_use) call da_trace_entry("da_setup_obs_structures_bufr")
16
17 !--------------------------------------------------------------------------
18 ! [1.0] Scan BUFR observation header and get idea of number of obs:
19 !--------------------------------------------------------------------------
20
21 if (num_fgat_time > 1) then
22 filename = ' '
23
24 do n=1, num_fgat_time
25 iv%time = n
26
27 write(filename(1:10), fmt='(a, i2.2,a)') 'ob', n,'.bufr'
28
29 ! scan prepbufr observation file
30 call da_scan_obs_bufr (iv, filename)
31 iv%info(:)%plocal(n) = iv%info(:)%nlocal
32 iv%info(:)%ptotal(n) = iv%info(:)%ntotal
33 end do
34 else
35 iv%time = 1
36 filename="ob.bufr"
37 call da_scan_obs_bufr(iv, filename)
38 do i=1,num_ob_indexes
39 iv%info(i)%plocal(iv%time) = iv%info(i)%nlocal
40 iv%info(i)%ptotal(iv%time) = iv%info(i)%ntotal
41 end do
42
43 ! scan main body of radar observation file
44 ! if (use_radarobs) &
45 ! call da_scan_bufr_radar(iv, 'radar.dat')
46 end if
47
48 !-------------------------------------------------------------------------
49 ! Allocate the iv based on input number of obs:
50 !--------------------------------------------------------------------------
51
52 call da_allocate_observations (iv)
53
54 if (num_fgat_time > 1) then
55 do n=1, num_fgat_time
56 iv%time = n
57
58 write(filename(1:10), fmt='(a, i2.2)') 'ob.', n
59
60 ! read prepbufr observation file
61 call da_read_obs_bufr (iv, filename)
62
63 ! if (use_radarobs) then
64 ! ! read radar observation file
65 ! write(filename(1:10), fmt='(a, i2.2)') 'radarob.', n
66 ! call da_read_bufr_radar(iv, filename)
67 ! end if
68 end do
69 else
70
71 iv%time = 1
72
73 filename="ob.bufr"
74 call da_read_obs_bufr(iv, filename)
75
76 ! if (use_radarobs) then
77 ! ! read radar observation file
78 ! call da_read_bufr_radar(iv)
79 ! end if
80 end if
81
82 !--------------------------------------------------------------------------
83 ! [3.0] Calculate innovation vector (O-B) and create (smaller) ob structure:
84 !--------------------------------------------------------------------------
85
86 call da_fill_obs_structures(iv, ob)
87
88 iv%time = 1
89
90 if (trace_use) call da_trace_exit("da_setup_obs_structures_bufr")
91
92 end subroutine da_setup_obs_structures_bufr
93
94