-
Notifications
You must be signed in to change notification settings - Fork 0
/
preca_MJO_be362.m
247 lines (243 loc) · 4.16 KB
/
preca_MJO_be362.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Calculating the daily rainfall anomalies over SA %
% in each MJO phase for DJF %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
path(path,'C:/Users/Laís/Desktop/tese/scripts/Plot');
path(path,'C:/Users/Laís/Desktop/tese/scripts/toolbox_geral');
path(path,'C:/Users/Laís/Desktop/tese/scripts/toolbox_ocean');
%
clc
clear
%
cd G:/for_lais;
%
ncdisp('be362.jan-dec_dmeans_ts.years1-30.rmm_indices.nc')
%360-day calendar. The year is made of 12 months, each of which has 30 days
%10800 days in 30 years (30 * 360 = 10800)
%
amp = ncread('be362.jan-dec_dmeans_ts.years1-30.rmm_indices.nc',...
'amplitude');
%
phase = ncread('be362.jan-dec_dmeans_ts.years1-30.rmm_indices.nc',...
'phase');
%
phase(1:120) = NaN(120,1);% problem first 120 values = 2
%
cd G:/Lais_jasmin/u-be362/data
%
load preca
%
M = 360;%days in a year
%
amp = reshape(amp,M,K); phase = reshape(phase,M,K);
%
%Reducing amp and phase for DJF:
%
amp = amp'; phase = phase';
%
amp = cat(2,amp(:,1:60),amp(:,331:end));
%
phase = cat(2,phase(:,1:60),phase(:,331:end));
%
amp = amp'; phase = phase';
%
amp = reshape(amp,T,1); phase = reshape(phase,T,1);
%
preca = reshape(preca,I*J,T);
%
preca = preca';
%
preca_DJF = preca;%sample for all days in DJF for student t-test
%
save('preca_DJF','preca_DJF','-v7.3'); clear preca_DJF;
%
%Putting NaN in preca when the MJO is inactive (amplitude < 1)
%
for j = 1:I*J
for i = 1:T
if amp(i) < 1
preca(i,j) = NaN;
end
end
end
%
%Separating preca according to the MJO phases:
%
%MJO phase 1-------------------
%
preca_MJO_1 = preca;
%
for j = 1:I*J
for i = 1:T
if phase(i) ~= 1
preca_MJO_1(i,j) = NaN;
end
end
end
%
%Eliminating NaN:
%
a = find(isnan(preca_MJO_1(:,1)));
%
for i = a(:)
preca_MJO_1(a,:) = [];
end
%
%MJO phase 2-------------------
%
preca_MJO_2 = preca;
%
for j = 1:I*J
for i = 1:T
if phase(i) ~= 2
preca_MJO_2(i,j) = NaN;
end
end
end
%
%Eliminating NaN:
%
a = find(isnan(preca_MJO_2(:,1)));
%
for i = a(:)
preca_MJO_2(a,:) = [];
end
%
%MJO phase 3-------------------
%
preca_MJO_3 = preca;
%
for j = 1:I*J
for i = 1:T
if phase(i) ~= 3
preca_MJO_3(i,j) = NaN;
end
end
end
%
%Eliminating NaN:
%
a = find(isnan(preca_MJO_3(:,1)));
%
for i = a(:)
preca_MJO_3(a,:) = [];
end
%
%MJO phase 4-------------------
%
preca_MJO_4 = preca;
%
for j = 1:I*J
for i = 1:T
if phase(i) ~= 4
preca_MJO_4(i,j) = NaN;
end
end
end
%
%Eliminating NaN:
%
a = find(isnan(preca_MJO_4(:,1)));
%
for i = a(:)
preca_MJO_4(a,:) = [];
end
%
%MJO phase 5-------------------
%
preca_MJO_5 = preca;
%
for j = 1:I*J
for i = 1:T
if phase(i) ~= 5
preca_MJO_5(i,j) = NaN;
end
end
end
%
%Eliminating NaN:
%
a = find(isnan(preca_MJO_5(:,1)));
%
for i = a(:)
preca_MJO_5(a,:) = [];
end
%
%MJO phase 6-------------------
%
preca_MJO_6 = preca;
%
for j = 1:I*J
for i = 1:T
if phase(i) ~= 6
preca_MJO_6(i,j) = NaN;
end
end
end
%
%Eliminating NaN:
%
a = find(isnan(preca_MJO_6(:,1)));
%
for i = a(:)
preca_MJO_6(a,:) = [];
end
%
%MJO phase 7-------------------
%
preca_MJO_7 = preca;
%
for j = 1:I*J
for i = 1:T
if phase(i) ~= 7
preca_MJO_7(i,j) = NaN;
end
end
end
%
%Eliminating NaN:
%
a = find(isnan(preca_MJO_7(:,1)));
%
for i = a(:)
preca_MJO_7(a,:) = [];
end
%
%MJO phase 8-------------------
%
preca_MJO_8 = preca;
%
for j = 1:I*J
for i = 1:T
if phase(i) ~= 8
preca_MJO_8(i,j) = NaN;
end
end
end
%
%Eliminating NaN:
%
a = find(isnan(preca_MJO_8(:,1)));
%
for i = a(:)
preca_MJO_8(a,:) = [];
end
%
%Finding the number of days in each MJO phase in DJF:
%
[T1,n] = size(preca_MJO_1); [T2,n] = size(preca_MJO_2);
%
[T3,n] = size(preca_MJO_3); [T4,n] = size(preca_MJO_4);
%
[T5,n] = size(preca_MJO_5); [T6,n] = size(preca_MJO_6);
%
[T7,n] = size(preca_MJO_7); [T8,n] = size(preca_MJO_8);
%
n = [T1 T2 T3 T4 T5 T6 T7 T8];
%
save('preca_MJO','preca_MJO_1','preca_MJO_2','preca_MJO_3',...
'preca_MJO_4','preca_MJO_5','preca_MJO_6','preca_MJO_7','preca_MJO_8',...
'n','lat','lon','lat1','lon1','I','J','T','K','L','-v7.3');
%
cd G:/Lais_jasmin/u-be362/scripts