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

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

modification according to mlint diagnostic

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