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

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

squeeze multiple blank lines

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