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