source: trunk/src/mode_sahelien/composite_pluie_eof234_1030.m @ 45

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