da_deallocate_y.inc
References to this file elsewhere.
1 subroutine da_deallocate_y(y)
2
3 !---------------------------------------------------------------------------
4 ! Purpose: Deallocate arrays used in y and residual obs structures.
5 !
6 ! Method: Deallocate component in turn.
7 !---------------------------------------------------------------------------
8
9 implicit none
10
11 type (y_type), intent(inout) :: y ! residual type structure.
12 integer :: n,i ! Loop counter.
13
14
15 if (trace_use) call da_trace_entry("da_deallocate_y")
16
17 !---------------------------------------------------------------------------
18 ! [1.0] Deallocate:
19 !---------------------------------------------------------------------------
20
21 if (y % num_synop > 0) deallocate (y % synop)
22
23 if (y % num_ships > 0) deallocate (y % ships)
24
25 if (y % num_metar > 0) deallocate (y % metar)
26
27
28 if (y % num_sound > 0) then
29 do n = 1, y % num_sound
30 deallocate (y % sound(n)%u)
31 deallocate (y % sound(n)%v)
32 deallocate (y % sound(n)%t)
33 deallocate (y % sound(n)%q)
34 end do
35
36 deallocate (y % sound)
37
38 deallocate (y % sonde_sfc)
39 end if
40
41 if (y % num_pilot > 0) then
42 do n = 1, y % num_pilot
43 deallocate (y % pilot(n)%u)
44 deallocate (y % pilot(n)%v)
45 end do
46 deallocate (y % pilot)
47 end if
48
49 if (y % num_bogus > 0) then
50 do n = 1, y % num_bogus
51 deallocate (y % bogus(n)%u)
52 deallocate (y % bogus(n)%v)
53 deallocate (y % bogus(n)%t)
54 deallocate (y % bogus(n)%q)
55 end do
56 deallocate (y % bogus)
57 end if
58
59 if (y % num_Radar > 0) then
60 do n = 1, y % num_Radar
61 deallocate (y % Radar(n)%rv)
62 deallocate (y % Radar(n)%rf)
63 end do
64 deallocate (y % Radar)
65 end if
66
67
68 if (y % num_airep > 0) then
69 do n = 1, y % num_airep
70 deallocate (y % airep(n)%u)
71 deallocate (y % airep(n)%v)
72 deallocate (y % airep(n)%t)
73 end do
74 deallocate (y % airep)
75 end if
76
77 if (y % num_geoamv > 0) then
78 do n=1, y % num_geoamv
79 deallocate (y % geoamv(n) % u)
80 deallocate (y % geoamv(n) % v)
81 end do
82 deallocate (y % geoamv)
83 end if
84
85 if (y % num_polaramv > 0) then
86 do n=1, y % num_polaramv
87 deallocate (y % polaramv(n) % u)
88 deallocate (y % polaramv(n) % v)
89 end do
90 deallocate (y % polaramv)
91 end if
92
93 if (y % num_gpspw > 0) deallocate (y % gpspw)
94
95 if (y % num_gpsref > 0) then
96 do n = 1, y % num_gpsref
97 deallocate (y % gpsref(n)%ref)
98 deallocate (y % gpsref(n)% p)
99 deallocate (y % gpsref(n)% t)
100 deallocate (y % gpsref(n)% q)
101 end do
102 deallocate (y % gpsref)
103 end if
104
105 if (y % num_satem > 0) then
106 do n = 1, y % num_satem
107 deallocate (y % satem(n) % thickness)
108 end do
109 deallocate (y % satem)
110 end if
111
112 if (y % num_ssmi_tb > 0) deallocate (y % ssmi_tb)
113 if (y % num_ssmi_retrieval > 0) deallocate (y % ssmi_retrieval)
114 if (y % num_pseudo > 0) deallocate (y % pseudo)
115
116 if (y % num_ssmt1 > 0) then
117 do n = 1, y % num_ssmt1
118 deallocate (y % ssmt1(n) % t)
119 end do
120 deallocate (y % ssmt1)
121 end if
122
123 if (y % num_ssmt2 > 0) then
124 do n = 1, y % num_ssmt2
125 deallocate (y % ssmt2(n) % rh)
126 end do
127 deallocate (y % ssmt2)
128 end if
129
130 if (y % num_qscat > 0) deallocate (y % qscat)
131
132 if (y % num_profiler > 0) then
133 do n = 1, y % num_profiler
134 deallocate (y % profiler(n)%u)
135 deallocate (y % profiler(n)%v)
136 end do
137 deallocate (y % profiler)
138 end if
139
140 if (y % num_buoy > 0) deallocate (y % buoy)
141
142 ! radiance:
143
144 if (y % num_inst > 0) then
145 do i = 1, y % num_inst
146 if (y % instid(i) % num_rad < 1) cycle
147 ! deallocate (y % instid(i) % ichan)
148 deallocate ( y % instid(i) % tb )
149 end do
150 deallocate (y % instid)
151 end if
152 if (y % num_airsr > 0) then
153 do n = 1, y % num_airsr
154 deallocate (y % airsr(n)%t)
155 deallocate (y % airsr(n)%q)
156 end do
157 deallocate (y % airsr)
158 end if
159
160 if (trace_use) call da_trace_exit("da_deallocate_y")
161
162 end subroutine da_deallocate_y
163
164