1 | function composite_olr_phase_num(phase_num) |
---|
2 | % composite_olr_phase_num ++explication between 1 and 8 |
---|
3 | |
---|
4 | %+ |
---|
5 | % module |
---|
6 | % ====== |
---|
7 | % |
---|
8 | % ++ |
---|
9 | % |
---|
10 | % DESCRIPTION |
---|
11 | % =========== |
---|
12 | % |
---|
13 | % From ``olr.day.mean.nc`` and phase\ *phase_num*\ .txt, composite_olr_phase_num |
---|
14 | % compute ++, plot ++ |
---|
15 | % |
---|
16 | % CAUTIONS |
---|
17 | % ======== |
---|
18 | % |
---|
19 | % Need Statistics_Toolbox because of nanmean |
---|
20 | % |
---|
21 | % can't work with octave because of ncload and nanmean |
---|
22 | % |
---|
23 | % EXAMPLES |
---|
24 | % ======== |
---|
25 | % |
---|
26 | % Following line read olr.day.mean.nc and phase\ *phase_num*\ .txt, compute ++, |
---|
27 | % plot ++ |
---|
28 | % :: |
---|
29 | % |
---|
30 | % >> composite_olr_phase_num(1); |
---|
31 | % |
---|
32 | % SEE ALSO |
---|
33 | % ======== |
---|
34 | % |
---|
35 | % lagged_correlations_eof2_eof3_1030.m_ |
---|
36 | % |
---|
37 | % .. _lagged_correlations_eof2_eof3_1030.m : lagged_correlations_eof2_eof3_1030.m.html |
---|
38 | % |
---|
39 | % composite_olr_phase.m_ |
---|
40 | % |
---|
41 | % .. _composite_olr_phase.m : composite_olr_phase.m.html |
---|
42 | % |
---|
43 | % time_serie_histog_phase.m_ |
---|
44 | % |
---|
45 | % .. _time_serie_histog_phase.m : time_serie_histog_phase.m.html |
---|
46 | % |
---|
47 | % time_serie_histog_phase_num.m_ |
---|
48 | % |
---|
49 | % .. _time_serie_histog_phase_num.m : time_serie_histog_phase_num.m.html |
---|
50 | % |
---|
51 | % TODO |
---|
52 | % ==== |
---|
53 | % |
---|
54 | % improve description |
---|
55 | % |
---|
56 | % improve file pb |
---|
57 | % |
---|
58 | % use return function |
---|
59 | % |
---|
60 | % externalize time selection on olr.day.mean.nc |
---|
61 | % |
---|
62 | % test at the beginning if Statistics_Toolbox available |
---|
63 | % |
---|
64 | % test at the beginning if octave is running |
---|
65 | % |
---|
66 | % EVOLUTIONS |
---|
67 | % ========== |
---|
68 | % |
---|
69 | % $Id$ |
---|
70 | % |
---|
71 | % - fplod 2009-01-28T10:38:44Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
72 | % |
---|
73 | % * created from composite_olr_phase8.m to replace it as well as |
---|
74 | % composite_olr_phase[1-7].m |
---|
75 | % |
---|
76 | %- |
---|
77 | |
---|
78 | global IRCAAM_ID; |
---|
79 | global IRCAAM_OD; |
---|
80 | |
---|
81 | phase_num_min=1; |
---|
82 | phase_num_max=8; |
---|
83 | |
---|
84 | if nargin==1 |
---|
85 | % phase_num must be greater or equal to 1 and lower or equal to 8 |
---|
86 | if ((phase_num < phase_num_min) || (phase_num > phase_num_max)) |
---|
87 | disp(['phase_num_min = ', int2str(phase_num_min)]); |
---|
88 | disp(['phase_num_max = ', int2str(phase_num_max)]); |
---|
89 | error('eee : phase_num must be between phase_num_min and phase_num_max'); |
---|
90 | end |
---|
91 | else |
---|
92 | usage='usage : composite_olr_phase_num(phase_num)'; |
---|
93 | disp(usage); |
---|
94 | error('eee : wrong arguments numbers') |
---|
95 | end |
---|
96 | |
---|
97 | fullfilename=[IRCAAM_ID,'olr.day.mean.nc']; |
---|
98 | ncload(fullfilename); |
---|
99 | clear fullfilename; |
---|
100 | |
---|
101 | % taille 12327x73x144 1er juin 1974-31 decembre2007 |
---|
102 | % on enleve les annees 1974 a 1978 nombre de jours a enlever au debut 214+365+366+365+365 |
---|
103 | % on enleve les annees 2001 a 2008 nombre de jours a enlever au debut 12327-(365*3+366+365*3+60) |
---|
104 | |
---|
105 | debut=214+365+366+365+365; |
---|
106 | fin=12327-(365+60); |
---|
107 | olr=olr(debut:fin,21:41,:); |
---|
108 | siz=fin-debut+1; |
---|
109 | for a=1:21; |
---|
110 | for b=1:144; |
---|
111 | for c=1:siz; |
---|
112 | if olr(c,a,b)==32766; |
---|
113 | olr(c,a,b)=NaN; |
---|
114 | end; |
---|
115 | end ; |
---|
116 | end; |
---|
117 | end; |
---|
118 | olr=olr*0.01+327.65; |
---|
119 | olr1=zeros(siz,21,144); |
---|
120 | olr1(:,:,1:72)=olr(:,:,73:144); |
---|
121 | olr1(:,:,73:144)=olr(:,:,1:72); |
---|
122 | clear olr; |
---|
123 | |
---|
124 | % on permture le temps et l'espce |
---|
125 | % nouvelles dimentions |
---|
126 | % 21 144 siz |
---|
127 | olr1=permute(olr1, [2 3 1]); |
---|
128 | |
---|
129 | for a=1:21; |
---|
130 | for b=1:144; |
---|
131 | clear vecteur |
---|
132 | vecteur=zeros(siz,1); |
---|
133 | for c=1:siz; |
---|
134 | vecteur(c)=olr1(a,b,c); |
---|
135 | end; |
---|
136 | std_c=nanmean(vecteur); |
---|
137 | for c=1:siz; |
---|
138 | olr1(a,b,c)=olr1(a,b,c)-std_c; |
---|
139 | end; |
---|
140 | end; |
---|
141 | end; |
---|
142 | |
---|
143 | % on met sous la forme longitude latitude jour |
---|
144 | |
---|
145 | % on selectionne les mois d ete (attention aux annees bixestiles!) |
---|
146 | |
---|
147 | siz1=31+28+31+30+31+1; |
---|
148 | siz1bis=31+28+31+30+31+30+31+31+30; |
---|
149 | a=siz1bis-siz1; |
---|
150 | |
---|
151 | olr=zeros(21,144,122,28); |
---|
152 | |
---|
153 | siz2=siz1+366; siz2bis=siz2+a; % 1980 |
---|
154 | siz3=siz2+365; siz3bis=siz3+a; % 1981 |
---|
155 | siz4=siz3+365; siz4bis=siz4+a; % 1982 |
---|
156 | siz5=siz4+365; siz5bis=siz5+a; % 1983 |
---|
157 | siz6=siz5+366; siz6bis=siz6+a; % 1984 |
---|
158 | siz7=siz6+365; siz7bis=siz7+a; % 1985 |
---|
159 | siz8=siz7+365; siz8bis=siz8+a; % 1986 |
---|
160 | siz9=siz8+365; siz9bis=siz9+a; % 1987 |
---|
161 | siz10=siz9+366; siz10bis=siz10+a; % 1988 |
---|
162 | siz11=siz10+365; siz11bis=siz11+a; % 1989 |
---|
163 | siz12=siz11+365; siz12bis=siz12+a; % 1990 |
---|
164 | siz13=siz12+365; siz13bis=siz13+a; % 1991 |
---|
165 | siz14=siz13+366; siz14bis=siz14+a; % 1992 |
---|
166 | siz15=siz14+365; siz15bis=siz15+a; % 1993 |
---|
167 | siz16=siz15+365; siz16bis=siz16+a; % 1994 |
---|
168 | siz17=siz16+365; siz17bis=siz17+a; % 1995 |
---|
169 | siz18=siz17+366; siz18bis=siz18+a; % 1996 |
---|
170 | siz19=siz18+365; siz19bis=siz19+a; % 1997 |
---|
171 | siz20=siz19+365; siz20bis=siz20+a; % 1998 |
---|
172 | siz21=siz20+365; siz21bis=siz21+a; % 1999 |
---|
173 | siz22=siz21+366; siz22bis=siz22+a; % 2000 |
---|
174 | siz23=siz22+365; siz23bis=siz23+a; % 2001 |
---|
175 | siz24=siz23+365; siz24bis=siz24+a; % 2002 |
---|
176 | siz25=siz24+365; siz25bis=siz25+a; % 2003 |
---|
177 | siz26=siz25+366; siz26bis=siz26+a; % 2004 |
---|
178 | siz27=siz26+365; siz27bis=siz27+a; % 2005 |
---|
179 | siz28=siz27+365; siz28bis=siz28+a; % 2006 |
---|
180 | |
---|
181 | olr(:,:,:,1)=olr1(:,:,siz1:siz1bis); % 1979 |
---|
182 | olr(:,:,:,2)=olr1(:,:,siz2:siz2bis); % 1980 |
---|
183 | olr(:,:,:,3)=olr1(:,:,siz3:siz3bis); % 1981 |
---|
184 | olr(:,:,:,4)=olr1(:,:,siz4:siz4bis); % 1982 |
---|
185 | olr(:,:,:,5)=olr1(:,:,siz5:siz5bis); % 1983 |
---|
186 | olr(:,:,:,6)=olr1(:,:,siz6:siz6bis); % 1984 |
---|
187 | olr(:,:,:,7)=olr1(:,:,siz7:siz7bis); % 1985 |
---|
188 | olr(:,:,:,8)=olr1(:,:,siz8:siz8bis); % 1986 |
---|
189 | olr(:,:,:,9)=olr1(:,:,siz9:siz9bis); % 1987 |
---|
190 | olr(:,:,:,10)=olr1(:,:,siz10:siz10bis); % 1988 |
---|
191 | olr(:,:,:,11)=olr1(:,:,siz11:siz11bis); % 1989 |
---|
192 | olr(:,:,:,12)=olr1(:,:,siz12:siz12bis); % 1990 |
---|
193 | olr(:,:,:,13)=olr1(:,:,siz13:siz13bis); % 1991 |
---|
194 | olr(:,:,:,14)=olr1(:,:,siz14:siz14bis); % 1992 |
---|
195 | olr(:,:,:,15)=olr1(:,:,siz15:siz15bis); % 1993 |
---|
196 | olr(:,:,:,16)=olr1(:,:,siz16:siz16bis); % 1994 |
---|
197 | olr(:,:,:,17)=olr1(:,:,siz17:siz17bis); % 1995 |
---|
198 | olr(:,:,:,18)=olr1(:,:,siz18:siz18bis); % 1996 |
---|
199 | olr(:,:,:,19)=olr1(:,:,siz19:siz19bis); % 1997 |
---|
200 | olr(:,:,:,20)=olr1(:,:,siz20:siz20bis); % 1998 |
---|
201 | olr(:,:,:,21)=olr1(:,:,siz21:siz21bis); % 1999 |
---|
202 | olr(:,:,:,22)=olr1(:,:,siz22:siz22bis); % 2000 |
---|
203 | olr(:,:,:,23)=olr1(:,:,siz23:siz23bis); % 2001 |
---|
204 | olr(:,:,:,24)=olr1(:,:,siz24:siz24bis); % 2002 |
---|
205 | olr(:,:,:,25)=olr1(:,:,siz25:siz25bis); % 2003 |
---|
206 | olr(:,:,:,26)=olr1(:,:,siz26:siz26bis); % 2004 |
---|
207 | olr(:,:,:,27)=olr1(:,:,siz27:siz27bis); % 2005 |
---|
208 | olr(:,:,:,28)=olr1(:,:,siz28:siz28bis); % 2006 |
---|
209 | |
---|
210 | clear siz1 siz1bis; |
---|
211 | clear siz2 siz2bis; |
---|
212 | clear siz3 siz3bis; |
---|
213 | clear siz4 siz4bis; |
---|
214 | clear siz5 siz5bis; |
---|
215 | clear siz6 siz6bis; |
---|
216 | clear siz7 siz7bis; |
---|
217 | clear siz8 siz8bis; |
---|
218 | clear siz9 siz9bis; |
---|
219 | clear siz10 siz10bis; |
---|
220 | clear siz11 siz11bis; |
---|
221 | clear siz12 siz12bis; |
---|
222 | clear siz13 siz13bis; |
---|
223 | clear siz14 siz14bis; |
---|
224 | clear siz15 siz15bis; |
---|
225 | clear siz16 siz16bis; |
---|
226 | clear siz17 siz17bis; |
---|
227 | clear siz18 siz18bis; |
---|
228 | clear siz19 siz19bis; |
---|
229 | clear siz20 siz20bis; |
---|
230 | clear siz21 siz21bis; |
---|
231 | clear siz22 siz22bis; |
---|
232 | clear siz23 siz23bis; |
---|
233 | clear siz24 siz24bis; |
---|
234 | clear siz25 siz25bis; |
---|
235 | clear siz26 siz26bis; |
---|
236 | clear siz27 siz27bis; |
---|
237 | clear siz28 siz28bis; |
---|
238 | |
---|
239 | %olr=zeros(21,144,122,28); |
---|
240 | olr1=permute(olr,[3 4 1 2]); |
---|
241 | clear olr; |
---|
242 | olr2=reshape(olr1,3416,21,144); |
---|
243 | olr3(:,:)=mean(olr2); |
---|
244 | clear olr2; |
---|
245 | |
---|
246 | fullfilename=[IRCAAM_OD,'phase',int2str(phase_num),'.txt']; |
---|
247 | status=load(fullfilename); |
---|
248 | clear fullfilename; |
---|
249 | |
---|
250 | phase=status; |
---|
251 | clear status; |
---|
252 | phase=reshape(phase,122,28,3); |
---|
253 | olr_filtre_compomax=zeros(90,21,144); |
---|
254 | compteurmax=0; |
---|
255 | |
---|
256 | % boucle sur les annees |
---|
257 | for a=1:28; |
---|
258 | % boucle sur les jours |
---|
259 | for b=1:122; |
---|
260 | % 1ere condition (laisser une marge de 10) |
---|
261 | if (b>11 && b<112); |
---|
262 | if phase(b,a,1)==1; |
---|
263 | compteurmax=compteurmax+1; |
---|
264 | olr_filtre_compomax(compteurmax,:,:)=olr1(b,a,:,:); |
---|
265 | end; |
---|
266 | end; |
---|
267 | end; |
---|
268 | end; |
---|
269 | disp(['iii : compteurmax =', int2str(compteurmax)]); |
---|
270 | % on ne selectionne que la partie du tableau ou il y a des valeurs |
---|
271 | olr_filtre_compomax=olr_filtre_compomax(1:compteurmax,:,:); |
---|
272 | |
---|
273 | % on fait la somme des valeurs de olr_filtreentiel sur le nbre d occurences |
---|
274 | % on obtent un tableau de la forme (jours-avant-apres,lon,lat) |
---|
275 | olr_filtre_compomax1(:,:)=mean(olr_filtre_compomax); |
---|
276 | clear olr_filtre_compomax; |
---|
277 | |
---|
278 | x=[-10:1:10]'; |
---|
279 | |
---|
280 | lat=lat(21:41)'; |
---|
281 | lon=lon-180; |
---|
282 | delta=olr_filtre_compomax1-olr3; |
---|
283 | clear olr3; |
---|
284 | for b=1:21; |
---|
285 | for c=1:144; |
---|
286 | if delta(b,c)<-50; |
---|
287 | delta(b,c)=-50; |
---|
288 | elseif delta(b,c)>50; |
---|
289 | delta(b,c)=50; |
---|
290 | end; |
---|
291 | end; |
---|
292 | end; |
---|
293 | palette; |
---|
294 | delta(1,1)=-50.0001; |
---|
295 | delta(1,2)=50.0001; |
---|
296 | aa=contourf(lon,lat,delta,[-50:5:50],'LineStyle','none'); |
---|
297 | set (gca,'XTick',[-180:60:180],'XTickLabel',[' 180';'120W';' 60W';' 0';' 60E';'120E';' 180'],'fontsize',6); |
---|
298 | set (gca,'YTick',[-10:10:40],'YTickLabel',[' ';' 0';'10N';'20N';'30N';' '],'fontname','Arial','fontsize',6); |
---|
299 | co=colorbar; |
---|
300 | set(co,'xtick',[-20:10:20],'xticklabel',[-20:10:20],'fontname','Arial','fontsize',6); |
---|
301 | hold on; |
---|
302 | cartemonde1; |
---|
303 | set (gca,'tickDir','out'); |
---|
304 | axis equal; |
---|
305 | axis([-180 180 -10 40]); |
---|