da_deallocate_observations.inc

References to this file elsewhere.
1 subroutine da_deallocate_observations (iv)
2 
3    !---------------------------------------------------------------------------
4    ! Purpose: Deallocate components of observation structure.
5    !---------------------------------------------------------------------------
6 
7    implicit none
8 
9    type (iv_type), intent(inout)        :: iv     ! 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 (iv%info(sound)%nlocal > 0) then
19       do n = 1, iv%info(sound)%nlocal
20          if (iv%info(sound)%levels(n) > 0) then
21             deallocate (iv%sound (n) % h)
22             deallocate (iv%sound (n) % p)
23             deallocate (iv%sound (n) % u)
24             deallocate (iv%sound (n) % v)
25             deallocate (iv%sound (n) % t)
26             deallocate (iv%sound (n) % q)
27          end if
28       end do
29 
30       deallocate (iv%sound)
31 
32       deallocate (iv%sonde_sfc)
33    end if
34 
35    if (iv%info(synop)%nlocal > 0) deallocate (iv%synop)
36 
37    if (iv%info(airep)%nlocal > 0) then
38       do n = 1, iv%info(airep)%nlocal
39          deallocate (iv%airep (n) % h)
40          deallocate (iv%airep (n) % p)
41          deallocate (iv%airep (n) % u)
42          deallocate (iv%airep (n) % v)
43          deallocate (iv%airep (n) % t)
44       end do
45 
46       deallocate (iv%airep)
47    end if
48 
49    if (iv%info(satem)%nlocal > 0) then
50       do n = 1, iv%info(satem)%nlocal
51          deallocate (iv%satem(n) % p)
52          deallocate (iv%satem(n) % thickness)
53          deallocate (iv%satem(n) % org_thickness)
54       end do
55       deallocate (iv%satem)
56    end if
57 
58    if (iv%info(geoamv)%nlocal > 0) then
59       do n = 1, iv%info(geoamv)%nlocal
60          deallocate (iv%geoamv(n) % p)
61          deallocate (iv%geoamv(n) % u)
62          deallocate (iv%geoamv(n) % v)
63       end do
64       deallocate (iv%geoamv)
65    end if
66 
67 
68    if (iv%info(polaramv)%nlocal > 0) then
69       do n = 1, iv%info(polaramv)%nlocal
70          deallocate (iv%polaramv(n) % p)
71          deallocate (iv%polaramv(n) % u)
72          deallocate (iv%polaramv(n) % v)
73       end do
74       deallocate (iv%polaramv)
75    end if
76 
77    if (iv%info(metar)%nlocal > 0) deallocate (iv%metar)
78    if (iv%info(ships)%nlocal > 0) deallocate (iv%ships)
79 
80    if (iv%info(pilot)%nlocal > 0) then
81       do n = 1, iv%info(pilot)%nlocal
82          deallocate (iv%pilot (n) % p)
83          deallocate (iv%pilot (n) % u)
84          deallocate (iv%pilot (n) % v)
85       end do
86 
87       deallocate (iv%pilot)
88    end if
89 
90    if (iv%info(bogus)%nlocal > 0) then
91       do n = 1, iv%info(bogus)%nlocal
92          deallocate (iv%bogus (n) % h)
93          deallocate (iv%bogus (n) % p)
94          deallocate (iv%bogus (n) % u)
95          deallocate (iv%bogus (n) % v)
96          deallocate (iv%bogus (n) % t)
97          deallocate (iv%bogus (n) % q)
98       end do
99 
100       deallocate (iv%bogus)
101    end if
102 
103    if (iv%info(radar)%nlocal > 0) then
104       do n = 1, iv%info(radar)%nlocal
105          deallocate (iv%radar (n) % model_p)
106          deallocate (iv%radar (n) % model_rho)
107          deallocate (iv%radar (n) % model_qrn)
108          deallocate (iv%radar (n) % height  )
109          deallocate (iv%radar (n) % height_qc)
110          deallocate (iv%radar (n) % rv      )
111          deallocate (iv%radar (n) % rf      )
112       end do
113 
114       deallocate (iv%radar)
115    end if
116 
117    if (iv%info(gpspw)%nlocal > 0) deallocate (iv%gpspw)
118 
119    if (iv%info(gpsref)%nlocal > 0) then
120       do n = 1, iv%info(gpsref)%nlocal
121          deallocate (iv%gpsref(n) %  h)
122          deallocate (iv%gpsref(n) % ref)
123          deallocate (iv%gpsref(n) %   p)
124          deallocate (iv%gpsref(n) %   t)
125          deallocate (iv%gpsref(n) %   q)
126       end do
127       deallocate (iv%gpsref)
128    end if
129 
130    if (iv%info(ssmi_tb)%nlocal > 0) deallocate (iv%ssmi_tb)
131    if (iv%info(ssmi_rv)%nlocal > 0) deallocate (iv%ssmi_rv)
132 
133    if (iv%info(ssmt1)%nlocal > 0) then
134       do n = 1, iv%info(ssmt1)%nlocal
135          deallocate (iv%ssmt1(n) % h)
136          deallocate (iv%ssmt1(n) % p)
137          deallocate (iv%ssmt1(n) % t)
138       end do
139    
140       deallocate (iv%ssmt1)
141    end if
142    
143    if (iv%info(ssmt2)%nlocal > 0) then
144       do n = 1, iv%info(ssmt2)%nlocal
145          deallocate (iv%ssmt2(n) % h)
146          deallocate (iv%ssmt2(n) % p)
147          deallocate (iv%ssmt2(n) % rh)
148       end do
149    
150       deallocate (iv%ssmt2)
151    end if
152 
153    if (iv%info(qscat)%nlocal > 0) deallocate (iv%qscat)
154 
155    if (iv%info(profiler)%nlocal > 0) then
156       do n = 1, iv%info(profiler)%nlocal
157          deallocate (iv%profiler(n)%p)
158          deallocate (iv%profiler(n)%u)
159          deallocate (iv%profiler(n)%v)
160       end do
161 
162       deallocate(iv%profiler)
163    end if
164 
165    if (iv%info(buoy)%nlocal     > 0) deallocate(iv%buoy)
166 
167    if (iv%info(airsr)%nlocal > 0) then
168       do n = 1, iv%info(airsr)%nlocal
169          deallocate (iv%airsr (n) % h)
170          deallocate (iv%airsr (n) % p)
171          deallocate (iv%airsr (n) % t)
172          deallocate (iv%airsr (n) % q)
173       end do
174 
175       deallocate (iv%airsr)
176    end if
177 
178    if (trace_use) call da_trace_exit("da_deallocate_observations")
179 
180 end subroutine da_deallocate_observations
181 
182