source: trunk/src/mode_sahelien/composite_pluie_ird_rossby30100b.m @ 37

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

add semi-colon after end everywhere

File size: 7.2 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; fid=fopen('pluvio.79.haut','r','b'); siz=41*17*365;
14v=fread(fid,siz,'float'); fclose(fid);
15v=reshape(v,41,17,365);
16clear a b c;
17for a=1:41;
18   for b=1:17;
19       for c=1:365;
20          if v(a,b,c)>990;
21              v(a,b,c)=NaN;
22          elseif v(a,b,c)<0;
23              v(a,b,c)=NaN;
24          end;
25       end;
26   end;
27end;
28pluie(:,:,:,1)=v(:,:,siz1:siz1bis); % 1979
29
30clear v fid; fid=fopen('pluvio.80.haut','r','b'); siz=41*17*366;
31v=fread(fid,siz,'float'); fclose(fid);
32v=reshape(v,41,17,366);
33clear a b c;
34for a=1:41;
35   for b=1:17;
36       for c=1:366;
37          if v(a,b,c)>990;
38              v(a,b,c)=NaN;
39          elseif v(a,b,c)<0;
40              v(a,b,c)=NaN;
41          end;
42       end;
43   end;
44end;
45pluie(:,:,:,2)=v(:,:,siz1+1:siz1bis+1); % 1980
46
47clear v fid; fid=fopen('pluvio.81.haut','r','b'); siz=41*17*365;
48v=fread(fid,siz,'float'); fclose(fid);
49v=reshape(v,41,17,365);
50clear a b c;
51for a=1:41;
52   for b=1:17;
53       for c=1:365;
54          if v(a,b,c)>990;
55              v(a,b,c)=NaN;
56          elseif v(a,b,c)<0;
57              v(a,b,c)=NaN;
58          end;
59       end;
60   end;
61end;
62pluie(:,:,:,3)=v(:,:,siz1:siz1bis); % 1981
63
64clear v fid; fid=fopen('pluvio.82.haut','r','b'); siz=41*17*365;
65v=fread(fid,siz,'float'); fclose(fid);
66v=reshape(v,41,17,365);
67clear a b c;
68for a=1:41;
69   for b=1:17;
70       for c=1:365;
71          if v(a,b,c)>990;
72              v(a,b,c)=NaN;
73          elseif v(a,b,c)<0;
74              v(a,b,c)=NaN;
75          end;
76       end;
77   end;
78end;
79pluie(:,:,:,4)=v(:,:,siz1:siz1bis); % 1982
80
81clear v fid; fid=fopen('pluvio.83.haut','r','b'); siz=41*17*365;
82v=fread(fid,siz,'float'); fclose(fid);
83v=reshape(v,41,17,365);
84clear a b c;
85for a=1:41;
86   for b=1:17;
87       for c=1:365;
88          if v(a,b,c)>990;
89              v(a,b,c)=NaN;
90          elseif v(a,b,c)<0;
91              v(a,b,c)=NaN;
92          end;
93       end;
94   end;
95end;
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;
220
221status=load('eof12_rossby_30100.txt');
222eof12_rossby_30100=status;
223clear status;
224
225% on met sous la forme annee mois
226eof12_rossby_30100=reshape(eof12_rossby_30100,122,28);
227% selection des annees avant 1990
228olr_eof=eof12_rossby_30100(:,1:12);
229clear eof12_rossby_30100;
230
231% on calcule l ecart type sur la serie temporelle de l'olr
232k=122*12;
233olrbis=reshape(olr_eof,k,1);
234olrbis=std(olrbis);
235
236% intialisation des tableaux
237pluie_filtre_compomax=NaN*ones(30,17,41);
238pluie_filtre_compomin=NaN*ones(30,17,41);
239pluie=permute(pluie,[3 4 2 1]);
240compteurmax=0;
241compteurmin=0;
242
243% boucle sur les annees
244for a=1:12;
245   clear delta;
246   delta=zeros(122,1);
247   % boucle sur les jours : on prepare avant
248   for b=1:122;
249        if b>1;
250            delta(b)=olr_eof(b,a)-olr_eof(b-1,a);
251        end;
252   end;
253   % boucle sur les jours
254   for b=1:122;
255      % 1ere condition (laisser une marge de 10)
256      if (b>20 && b<112);
257% cas 1 : max deltas apres negetifs et deltas avant postifs
258         if (delta(b+1)<0 && delta(b)<0 && delta(b-1)>0 && delta(b-2)>0 && olr_eof(b,a)>olrbis);
259            compteurmax=compteurmax+1;
260            pluie_filtre_compomax(compteurmax,:,:)=pluie(b,a,:,:);
261% cas 2 : min deltas apres positifs et deltas avant negatifs
262         elseif (delta(b+1)>0 && delta(b)>0 && delta(b-1)<0 && delta(b-2)<0 && olr_eof(b,a)<(-olrbis));
263            compteurmin=compteurmin+1;
264            pluie_filtre_compomin(compteurmin,:,:)=pluie(b,a,:,:);
265         end;
266      end;
267   end;
268end;
269
270% on fait la somme des valeurs de pluie_filtreentiel sur le nbre d occurences
271% on obtent un tableau de la forme (jours-avant-apres,lon,lat)
272pluie_filtre_compomin1(:,:)=nanmean(pluie_filtre_compomin);
273clear pluie_filtre_compomin;
274pluie_filtre_compomax1(:,:)=nanmean(pluie_filtre_compomax);
275clear pluie_filtre_compomax;
276
277clear pluie_min pluie_max;
278
279pluie_min=pluie_filtre_compomin1;
280pluie_max=pluie_filtre_compomax1;
281
282diff=pluie_min-pluie_max;
283
284sauvegrads('composite_pluie_ird_30100',diff,[-70 2.5 -10 2.5]);
285
286for b=1:17;
287    for c=1:41;
288         if diff(b,c)<-5;
289             diff(b,c)=5;
290          elseif diff(b,c)>5;
291             diff(b,c)=5;
292         end;
293    end;
294end;
295diff(1,1)=-5.01;
296diff(1,2)=5.01;
297
298palette
299lat=[-10:2.5:30];
300lon=[-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;
Note: See TracBrowser for help on using the repository browser.