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

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

remove trailing blanks, split lines with multiple statements

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