source: trunk/src/mode_sahelien/composite_pluie_eof23_1030.m @ 91

Last change on this file since 91 was 26, checked in by pinsard, 15 years ago

add semi-colon after end everywhere

File size: 7.1 KB
Line 
1%
2
3%%%%%%%%%%%%%%% FICHIER pluie IRD
4% ouverture / lecture du fichier
5clear;
6
7% on selectionne les mois d ete (attention aux annees bixestiles!)
8
9siz1=31+28+31+30+31+1;
10siz1bis=31+28+31+30+31+30+31+31+30;
11pluie=zeros(41,17,122,12);
12
13clear v fid;
14fid=fopen('pluvio.79.haut','r','b');
15siz=41*17*365;
16v=fread(fid,siz,'float');
17fclose(fid);
18v=reshape(v,41,17,365);
19clear a b c;
20for a=1:41;
21   for b=1:17;
22       for c=1:365;
23          if v(a,b,c)>990;
24              v(a,b,c)=NaN;
25          elseif v(a,b,c)<0;
26              v(a,b,c)=NaN;
27          end;
28       end;
29   end;
30end;
31pluie(:,:,:,1)=v(:,:,siz1:siz1bis); % 1979
32
33clear v fid; fid=fopen('pluvio.80.haut','r','b'); siz=41*17*366;
34v=fread(fid,siz,'float'); fclose(fid);
35v=reshape(v,41,17,366);
36clear a b c;
37for a=1:41;
38   for b=1:17;
39       for c=1:366;
40          if v(a,b,c)>990;
41              v(a,b,c)=NaN;
42          elseif v(a,b,c)<0;
43              v(a,b,c)=NaN;
44          end;
45       end;
46   end;
47end;
48pluie(:,:,:,2)=v(:,:,siz1+1:siz1bis+1); % 1980
49
50clear v fid; fid=fopen('pluvio.81.haut','r','b'); siz=41*17*365;
51v=fread(fid,siz,'float'); fclose(fid);
52v=reshape(v,41,17,365);
53clear a b c;
54for a=1:41;
55   for b=1:17;
56       for c=1:365;
57          if v(a,b,c)>990;
58              v(a,b,c)=NaN;
59          elseif v(a,b,c)<0;
60              v(a,b,c)=NaN;
61          end;
62       end;
63   end;
64end;
65pluie(:,:,:,3)=v(:,:,siz1:siz1bis); % 1981
66
67clear v fid; fid=fopen('pluvio.82.haut','r','b'); siz=41*17*365;
68v=fread(fid,siz,'float'); fclose(fid);
69v=reshape(v,41,17,365);
70clear a b c;
71for a=1:41;
72   for b=1:17;
73       for c=1:365;
74          if v(a,b,c)>990;
75              v(a,b,c)=NaN;
76          elseif v(a,b,c)<0;
77              v(a,b,c)=NaN;
78          end;
79       end;
80   end;
81end;
82pluie(:,:,:,4)=v(:,:,siz1:siz1bis); % 1982
83
84clear v fid; fid=fopen('pluvio.83.haut','r','b'); siz=41*17*365;
85v=fread(fid,siz,'float'); fclose(fid);
86v=reshape(v,41,17,365);
87clear a b c;
88for a=1:41;
89   for b=1:17;
90       for c=1:365;
91          if v(a,b,c)>990;
92              v(a,b,c)=NaN;
93          elseif v(a,b,c)<0;
94              v(a,b,c)=NaN;
95          end;
96       end;
97   end;
98end;
99
100pluie(:,:,:,5)=v(:,:,siz1:siz1bis); % 1983
101
102clear v fid; fid=fopen('pluvio.84.haut','r','b'); siz=41*17*366;
103v=fread(fid,siz,'float'); fclose(fid);
104v=reshape(v,41,17,366);
105clear a b c;
106for a=1:41;
107   for b=1:17;
108       for c=1:366;
109          if v(a,b,c)>990;
110              v(a,b,c)=NaN;
111          elseif v(a,b,c)<0;
112              v(a,b,c)=NaN;
113          end;
114       end;
115   end;
116end;
117pluie(:,:,:,6)=v(:,:,siz1+1:siz1bis+1); % 1984
118
119clear v fid; fid=fopen('pluvio.85.haut','r','b'); siz=41*17*365;
120v=fread(fid,siz,'float'); fclose(fid);
121v=reshape(v,41,17,365);
122clear a b c;
123for a=1:41;
124   for b=1:17;
125       for c=1:365;
126          if v(a,b,c)>990;
127              v(a,b,c)=NaN;
128          elseif v(a,b,c)<0;
129              v(a,b,c)=NaN;
130          end;
131       end;
132   end;
133end;
134pluie(:,:,:,7)=v(:,:,siz1:siz1bis); % 1985
135
136clear v fid; fid=fopen('pluvio.86.haut','r','b'); siz=41*17*365;
137v=fread(fid,siz,'float'); fclose(fid);
138v=reshape(v,41,17,365);
139clear a b c;
140for a=1:41;
141   for b=1:17;
142       for c=1:365;
143          if v(a,b,c)>990;
144              v(a,b,c)=NaN;
145          elseif v(a,b,c)<0;
146              v(a,b,c)=NaN;
147          end;
148       end;
149   end;
150end;
151pluie(:,:,:,8)=v(:,:,siz1:siz1bis); % 1986
152
153clear v fid; fid=fopen('pluvio.87.haut','r','b'); siz=41*17*365;
154v=fread(fid,siz,'float'); fclose(fid);
155v=reshape(v,41,17,365);
156clear a b c;
157for a=1:41;
158   for b=1:17;
159       for c=1:365;
160          if v(a,b,c)>990;
161              v(a,b,c)=NaN;
162          elseif v(a,b,c)<0;
163              v(a,b,c)=NaN;
164          end;
165       end;
166   end;
167end;
168pluie(:,:,:,9)=v(:,:,siz1:siz1bis); % 1987
169
170clear v fid; fid=fopen('pluvio.88.haut','r','b'); siz=41*17*366;
171v=fread(fid,siz,'float'); fclose(fid);
172v=reshape(v,41,17,366);
173clear a b c;
174for a=1:41;
175   for b=1:17;
176       for c=1:366;
177          if v(a,b,c)>990;
178              v(a,b,c)=NaN;
179          elseif v(a,b,c)<0;
180              v(a,b,c)=NaN;
181          end;
182       end;
183   end;
184end;
185pluie(:,:,:,10)=v(:,:,siz1:siz1bis); % 1988
186
187clear v fid; fid=fopen('pluvio.89.haut','r','b'); siz=41*17*365;
188v=fread(fid,siz,'float'); fclose(fid);
189v=reshape(v,41,17,365);
190clear a b c;
191for a=1:41;
192   for b=1:17;
193       for c=1:365;
194          if v(a,b,c)>990;
195              v(a,b,c)=NaN;
196          elseif v(a,b,c)<0;
197              v(a,b,c)=NaN;
198          end;
199       end;
200   end;
201end;
202pluie(:,:,:,11)=v(:,:,siz1:siz1bis); % 1989
203
204clear v fid; fid=fopen('pluvio.90.haut','r','b'); siz=41*17*365;
205v=fread(fid,siz,'float'); fclose(fid);
206v=reshape(v,41,17,365);
207clear a b c;
208for a=1:41;
209   for b=1:17;
210       for c=1:365;
211          if v(a,b,c)>990;
212              v(a,b,c)=NaN;
213          elseif v(a,b,c)<0;
214              v(a,b,c)=NaN;
215          end;
216       end;
217   end;
218end;
219pluie(:,:,:,12)=v(:,:,siz1:siz1bis); % 1990
220
221clear siz sizbis;
222clear v;
223
224status=load('eof23_1030.txt');
225eof23_1030=status;
226clear status;
227
228% on met sous la forme annee mois
229eof23_1030=reshape(eof23_1030,122,28);
230olr_eof=eof23_1030(:,1:12); % selection des annees avant 1990
231clear eof23_1030
232
233% on calcule l ecart type sur la serie temporelle de l'olr
234k=122*12;
235olrbis=reshape(olr_eof,k,1);
236olrbis=std(olrbis);
237
238% intialisation des tableaux
239pluie_filtre_compomax=NaN*ones(30,17,41);
240pluie_filtre_compomin=NaN*ones(30,17,41);
241pluie=permute(pluie,[3 4 2 1]);
242compteurmax=0;
243compteurmin=0;
244
245% boucle sur les annees
246for a=1:12;
247   clear delta;
248   delta=zeros(122,1);
249   % boucle sur les jours : on prepare avant
250   for b=1:122;
251        if b>1;
252            delta(b)=olr_eof(b,a)-olr_eof(b-1,a);
253        end;
254   end;
255   % boucle sur les jours
256   for b=1:122;
257      % 1ere condition (laisser une marge de 10)
258      if (b>20 && b<112);
259% cas 1 : max deltas apres negetifs et deltas avant postifs
260         if (delta(b+1)<0 && delta(b)<0 && delta(b-1)>0 && delta(b-2)>0 && olr_eof(b,a)>olrbis);
261            compteurmax=compteurmax+1;
262            pluie_filtre_compomax(compteurmax,:,:)=pluie(b,a,:,:);
263% cas 2 : min deltas apres positifs et deltas avant negatifs
264         elseif (delta(b+1)>0 && delta(b)>0 && delta(b-1)<0 && delta(b-2)<0 && olr_eof(b,a)<(-olrbis));
265            compteurmin=compteurmin+1;
266            pluie_filtre_compomin(compteurmin,:,:)=pluie(b,a,:,:);
267         end;
268      end;
269   end;
270end;
271
272% on fait la somme des valeurs de pluie_filtreentiel sur le nbre d occurences
273% on obtent un tableau de la forme (jours-avant-apres,lon,lat)
274pluie_filtre_compomin1(:,:)=nanmean(pluie_filtre_compomin);
275clear pluie_filtre_compomin;
276pluie_filtre_compomax1(:,:)=nanmean(pluie_filtre_compomax);
277clear pluie_filtre_compomax;
278
279clear pluie_min pluie_max;
280
281pluie_min=pluie_filtre_compomin1;
282pluie_max=pluie_filtre_compomax1;
283
284diff=pluie_min-pluie_max;
285
286sauvegrads('composite_pluie_eof23',diff,[-70 2.5 -10 2.5]);
287
288for b=1:17;
289    for c=1:41;
290         if diff(b,c)<-5;
291             diff(b,c)=5;
292          elseif diff(b,c)>5;
293             diff(b,c)=5;
294         end;
295    end;
296end;
297diff(1,1)=-5.01;
298diff(1,2)=5.01;
299
300palette
301lat=[-10:2.5:30];
302lon=[-70:2.5:30]';
303
304contourf(lon,lat,diff,[-5:0.5:5],'LineStyle','none');
305caxis([-5 5])
306co=colorbar('horiz');
307set(co,'position',[0.15 0.26 0.3 0.02]);
308set(co,'xtick',[-4:2:4],'xticklabel',[-4:2:4],'fontname','Arial','fontsize',4);
309
310hold on;
Note: See TracBrowser for help on using the repository browser.