1 subroutine da_deallocate_y(y)
3 !---------------------------------------------------------------------------
4 ! Purpose: Deallocate arrays used in y and residual obs structures.
6 ! Method: Deallocate component in turn.
7 !---------------------------------------------------------------------------
11 type (y_type), intent(inout) :: y ! residual type structure.
12 integer :: n,i ! Loop counter.
15 if (trace_use) call da_trace_entry("da_deallocate_y")
17 !---------------------------------------------------------------------------
19 !---------------------------------------------------------------------------
21 if (y % nlocal(synop) > 0) deallocate (y % synop)
23 if (y % nlocal(ships) > 0) deallocate (y % ships)
25 if (y % nlocal(metar) > 0) deallocate (y % metar)
27 if (y % nlocal(rain) > 0) deallocate (y % rain)
29 if (y % nlocal(sound) > 0) then
30 do n = 1, y % nlocal(sound)
31 deallocate (y % sound(n)%u)
32 deallocate (y % sound(n)%v)
33 deallocate (y % sound(n)%t)
34 deallocate (y % sound(n)%q)
36 deallocate (y % sound)
39 if (y % nlocal(sonde_sfc) > 0) deallocate (y % sonde_sfc)
41 if (y % nlocal(mtgirs) > 0) then
42 do n = 1, y % nlocal(mtgirs)
43 deallocate (y % mtgirs(n)%u)
44 deallocate (y % mtgirs(n)%v)
45 deallocate (y % mtgirs(n)%t)
46 deallocate (y % mtgirs(n)%q)
49 deallocate (y % mtgirs)
53 if (y % nlocal(tamdar) > 0) then
54 do n = 1, y % nlocal(tamdar)
55 deallocate (y % tamdar(n)%u)
56 deallocate (y % tamdar(n)%v)
57 deallocate (y % tamdar(n)%t)
58 deallocate (y % tamdar(n)%q)
61 deallocate (y % tamdar)
64 if (y % nlocal(tamdar_sfc) > 0) deallocate (y % tamdar_sfc)
66 if (y % nlocal(pilot) > 0) then
67 do n = 1, y % nlocal(pilot)
68 deallocate (y % pilot(n)%u)
69 deallocate (y % pilot(n)%v)
71 deallocate (y % pilot)
74 if (y % nlocal(bogus) > 0) then
75 do n = 1, y % nlocal(bogus)
76 deallocate (y % bogus(n)%u)
77 deallocate (y % bogus(n)%v)
78 deallocate (y % bogus(n)%t)
79 deallocate (y % bogus(n)%q)
81 deallocate (y % bogus)
84 if (y % nlocal(radar) > 0) then
85 do n = 1, y % nlocal(radar)
86 deallocate (y % radar(n)%rv)
87 deallocate (y % radar(n)%rf)
88 if (associated(y%radar(n)%rqv)) deallocate(y%radar(n)%rqv)
89 if (associated(y%radar(n)%rgr)) deallocate(y%radar(n)%rgr)
90 if (associated(y%radar(n)%rsn)) deallocate(y%radar(n)%rsn)
91 if (associated(y%radar(n)%rrn)) deallocate(y%radar(n)%rrn)
93 deallocate (y % radar)
96 if (y % nlocal(lightning) > 0) then
97 do n = 1, y % nlocal(lightning)
98 deallocate (y % lightning(n)%w)
99 deallocate (y % lightning(n)%div)
100 deallocate (y % lightning(n)%qv)
102 deallocate (y % lightning)
105 if (y % nlocal(airep) > 0) then
106 do n = 1, y % nlocal(airep)
107 deallocate (y % airep(n)%u)
108 deallocate (y % airep(n)%v)
109 deallocate (y % airep(n)%t)
110 deallocate (y % airep(n)%q)
112 deallocate (y % airep)
115 if (y % nlocal(geoamv) > 0) then
116 do n=1, y % nlocal(geoamv)
117 deallocate (y % geoamv(n) % u)
118 deallocate (y % geoamv(n) % v)
120 deallocate (y % geoamv)
123 if (y % nlocal(polaramv) > 0) then
124 do n=1, y % nlocal(polaramv)
125 deallocate (y % polaramv(n) % u)
126 deallocate (y % polaramv(n) % v)
128 deallocate (y % polaramv)
131 if (y % nlocal(gpspw) > 0) deallocate (y % gpspw)
133 if (y % nlocal(gpsref) > 0) then
134 do n = 1, y % nlocal(gpsref)
135 deallocate (y % gpsref(n)%ref)
136 deallocate (y % gpsref(n)% p)
137 deallocate (y % gpsref(n)% t)
138 deallocate (y % gpsref(n)% q)
140 deallocate (y % gpsref)
143 if (y % nlocal(gpseph) > 0) then
144 do n = 1, y % nlocal(gpseph)
145 deallocate (y % gpseph(n)%eph)
147 deallocate (y % gpseph)
150 if (y % nlocal(satem) > 0) then
151 do n = 1, y % nlocal(satem)
152 deallocate (y % satem(n) % thickness)
154 deallocate (y % satem)
157 if (y % nlocal(ssmi_tb) > 0) deallocate (y % ssmi_tb)
158 if (y % nlocal(ssmi_rv) > 0) deallocate (y % ssmi_rv)
159 if (y % nlocal(pseudo) > 0) deallocate (y % pseudo)
161 if (y % nlocal(ssmt1) > 0) then
162 do n = 1, y % nlocal(ssmt1)
163 deallocate (y % ssmt1(n) % t)
165 deallocate (y % ssmt1)
168 if (y % nlocal(ssmt2) > 0) then
169 do n = 1, y % nlocal(ssmt2)
170 deallocate (y % ssmt2(n) % rh)
172 deallocate (y % ssmt2)
175 if (y % nlocal(qscat) > 0) deallocate (y % qscat)
177 if (y % nlocal(profiler) > 0) then
178 do n = 1, y % nlocal(profiler)
179 deallocate (y % profiler(n)%u)
180 deallocate (y % profiler(n)%v)
182 deallocate (y % profiler)
185 if (y % nlocal(buoy) > 0) deallocate (y % buoy)
189 if (y % num_inst > 0) then
190 do i = 1, y % num_inst
191 if (y % instid(i) % num_rad < 1) cycle
192 ! deallocate (y % instid(i) % ichan)
193 deallocate ( y % instid(i) % tb )
195 deallocate (y % instid)
197 if (y % nlocal(airsr) > 0) then
198 do n = 1, y % nlocal(airsr)
199 deallocate (y % airsr(n)%t)
200 deallocate (y % airsr(n)%q)
202 deallocate (y % airsr)
205 if (trace_use) call da_trace_exit("da_deallocate_y")
207 end subroutine da_deallocate_y