da_deallocate_observations.inc

References to this file elsewhere.
1 subroutine da_deallocate_observations (ob)
2 
3    !---------------------------------------------------------------------------
4    ! Purpose: Deallocate components of observation structure.
5    !---------------------------------------------------------------------------
6 
7    implicit none
8 
9    type (ob_type), intent(inout)        :: ob     ! Observation structure.
10    integer   :: n
11 
12    if (trace_use) call da_trace_entry("da_deallocate_observations")
13 
14    !---------------------------------------------------------------------------
15    ! [1.0] Deallocate:
16    !---------------------------------------------------------------------------
17 
18    if (ob % num_sound > 0) then
19       do n = 1, ob % num_sound
20          if (ob%sound(n)%info%levels > 0) then
21             deallocate (ob % sound (n) % h)
22             deallocate (ob % sound (n) % p)
23             deallocate (ob % sound (n) % zk)
24             deallocate (ob % sound (n) % u)
25             deallocate (ob % sound (n) % v)
26             deallocate (ob % sound (n) % t)
27             deallocate (ob % sound (n) % q)
28          end if
29       end do
30 
31       deallocate (ob % sound)
32 
33       deallocate (ob % sonde_sfc)
34    end if
35 
36    if (ob % num_synop > 0) deallocate (ob % synop)
37 
38    if (ob % num_airep > 0) then
39       do n = 1, ob % num_airep
40          deallocate (ob % airep (n) % h)
41          deallocate (ob % airep (n) % p)
42          deallocate (ob % airep (n) % zk)
43          deallocate (ob % airep (n) % u)
44          deallocate (ob % airep (n) % v)
45          deallocate (ob % airep (n) % t)
46       end do
47 
48       deallocate (ob % airep)
49    end if
50 
51    if (ob % num_satem > 0) then
52       do n = 1, ob % num_satem
53          deallocate (ob % satem(n) % p)
54          deallocate (ob % satem(n) % thickness)
55          deallocate (ob % satem(n) % org_thickness)
56       end do
57       deallocate (ob % satem)
58    end if
59 
60    if (ob % num_geoamv > 0) then
61       do n = 1, ob % num_geoamv
62          deallocate (ob % geoamv(n) % p)
63          deallocate (ob % geoamv(n) % zk)
64          deallocate (ob % geoamv(n) % u)
65          deallocate (ob % geoamv(n) % v)
66       end do
67       deallocate (ob % geoamv)
68    end if
69 
70 
71    if (ob % num_polaramv > 0) then
72       do n = 1, ob % num_polaramv
73          deallocate (ob % polaramv(n) % p)
74          deallocate (ob % polaramv(n) % zk)
75          deallocate (ob % polaramv(n) % u)
76          deallocate (ob % polaramv(n) % v)
77       end do
78       deallocate (ob % polaramv)
79    end if
80 
81    if (ob % num_metar > 0) deallocate (ob % metar)
82    if (ob % num_ships > 0) deallocate (ob % ships)
83 
84    if (ob % num_pilot > 0) then
85       do n = 1, ob % num_pilot
86          deallocate (ob % pilot (n) % p)
87          deallocate (ob % pilot (n) % zk)
88          deallocate (ob % pilot (n) % u)
89          deallocate (ob % pilot (n) % v)
90       end do
91 
92       deallocate (ob % pilot)
93    end if
94 
95    if (ob % num_bogus > 0) then
96       do n = 1, ob % num_bogus
97          deallocate (ob % bogus (n) % h)
98          deallocate (ob % bogus (n) % p)
99          deallocate (ob % bogus (n) % zk)
100          deallocate (ob % bogus (n) % u)
101          deallocate (ob % bogus (n) % v)
102          deallocate (ob % bogus (n) % t)
103          deallocate (ob % bogus (n) % q)
104       end do
105 
106       deallocate (ob % bogus)
107    end if
108 
109    if (ob % num_Radar > 0) then
110       do n = 1, ob % num_Radar
111          deallocate (ob % Radar (n) % height  )
112          deallocate (ob % Radar (n) % height_qc)
113          deallocate (ob % Radar (n) % zk      )
114          deallocate (ob % Radar (n) % rv      )
115          deallocate (ob % Radar (n) % rf      )
116       end do
117 
118       deallocate (ob % Radar)
119    end if
120 
121    if (ob % num_gpspw > 0) deallocate (ob % gpspw)
122 
123    if (ob % num_gpsref > 0) then
124       do n = 1, ob % num_gpsref
125          deallocate (ob % gpsref(n) %  h)
126          deallocate (ob % gpsref(n) %  zk)
127          deallocate (ob % gpsref(n) % ref)
128          deallocate (ob % gpsref(n) %   p)
129          deallocate (ob % gpsref(n) %   t)
130          deallocate (ob % gpsref(n) %   q)
131       end do
132       deallocate (ob % gpsref)
133    end if
134 
135    if (ob % num_ssmi_tb > 0) deallocate (ob % ssmi_tb)
136    if (ob % num_ssmi_retrieval > 0) deallocate (ob % ssmi_retrieval)
137 
138    if (ob % num_ssmt1 > 0) then
139       do n = 1, ob % num_ssmt1
140          deallocate (ob % ssmt1(n) % h)
141          deallocate (ob % ssmt1(n) % p)
142          deallocate (ob % ssmt1(n) % zk)
143          deallocate (ob % ssmt1(n) % t)
144       end do
145    
146       deallocate (ob % ssmt1)
147    end if
148    
149    if (ob % num_ssmt2 > 0) then
150       do n = 1, ob % num_ssmt2
151          deallocate (ob % ssmt2(n) % h)
152          deallocate (ob % ssmt2(n) % p)
153          deallocate (ob % ssmt2(n) % zk)
154          deallocate (ob % ssmt2(n) % rh)
155       end do
156    
157       deallocate (ob % ssmt2)
158    end if
159 
160    if (ob % num_qscat > 0) deallocate (ob % qscat)
161 
162    if (ob%num_profiler > 0) then
163       do n = 1, ob % num_profiler
164          deallocate (ob%profiler(n)%p)
165          deallocate (ob%profiler(n)%zk)
166          deallocate (ob%profiler(n)%u)
167          deallocate (ob%profiler(n)%v)
168       end do
169 
170       deallocate(ob%profiler)
171    end if
172 
173    if (ob%num_buoy     > 0) deallocate(ob%buoy)
174 
175    if (ob % num_airsr > 0) then
176       do n = 1, ob % num_airsr
177          deallocate (ob % airsr (n) % h)
178          deallocate (ob % airsr (n) % p)
179          deallocate (ob % airsr (n) % zk)
180          deallocate (ob % airsr (n) % t)
181          deallocate (ob % airsr (n) % q)
182       end do
183 
184       deallocate (ob % airsr)
185    end if
186 
187    if (trace_use) call da_trace_exit("da_deallocate_observations")
188 
189 end subroutine da_deallocate_observations
190 
191