source: trunk/src/mode_sahelien/composite_hgt925_rossby.m @ 23

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

replace fcommands save, load and print by function calls

File size: 11.9 KB
Line 
1%
2
3% initialisation
4clear;
5close all;
6
7% etape 1 :on selectionne les mois d ete (attention aux annees bixestiles!)
8%          on compile sous forme d'un seul fichier
9
10hgt700=zeros(122,49,144,22);
11
12siz=31+28+31+30+31+1;
13sizbis=31+28+31+30+31+30+31+31+30;
14ncload('hgt700.1979.nc'); hgt700(:,:,:,1)=hgt(siz:sizbis,1,:,:); clear hgt;
15
16ncload('hgt700.1980.nc'); hgt700(:,:,:,2)=hgt(siz+1:sizbis+1,1,:,:); clear hgt;
17ncload('hgt700.1981.nc'); hgt700(:,:,:,3)=hgt(siz:sizbis,1,:,:);clear hgt;
18ncload('hgt700.1982.nc'); hgt700(:,:,:,4)=hgt(siz:sizbis,1,:,:);clear hgt;
19ncload('hgt700.1983.nc'); hgt700(:,:,:,5)=hgt(siz:sizbis,1,:,:);clear hgt;
20ncload('hgt700.1984.nc'); hgt700(:,:,:,6)=hgt(siz+1:sizbis+1,1,:,:);clear hgt;
21ncload('hgt700.1985.nc'); hgt700(:,:,:,7)=hgt(siz:sizbis,1,:,:);clear hgt;
22ncload('hgt700.1986.nc'); hgt700(:,:,:,8)=hgt(siz:sizbis,1,:,:);clear hgt;
23ncload('hgt700.1987.nc'); hgt700(:,:,:,9)=hgt(siz:sizbis,1,:,:);clear hgt;
24ncload('hgt700.1988.nc'); hgt700(:,:,:,10)=hgt(siz+1:sizbis+1,1,:,:);clear hgt;
25ncload('hgt700.1989.nc'); hgt700(:,:,:,11)=hgt(siz:sizbis,1,:,:);clear hgt;
26ncload('hgt700.1990.nc'); hgt700(:,:,:,12)=hgt(siz:sizbis,1,:,:);clear hgt;
27ncload('hgt700.1991.nc'); hgt700(:,:,:,13)=hgt(siz:sizbis,1,:,:);clear hgt;
28ncload('hgt700.1992.nc'); hgt700(:,:,:,14)=hgt(siz+1:sizbis+1,1,:,:);clear hgt;
29ncload('hgt700.1993.nc'); hgt700(:,:,:,15)=hgt(siz:sizbis,1,:,:);clear hgt;
30ncload('hgt700.1994.nc'); hgt700(:,:,:,16)=hgt(siz:sizbis,1,:,:);clear hgt;
31ncload('hgt700.1995.nc'); hgt700(:,:,:,17)=hgt(siz:sizbis,1,:,:);clear hgt;
32ncload('hgt700.1996.nc'); hgt700(:,:,:,18)=hgt(siz+1:sizbis+1,1,:,:);clear hgt;
33ncload('hgt700.1997.nc'); hgt700(:,:,:,19)=hgt(siz:sizbis,1,:,:);clear hgt;
34ncload('hgt700.1998.nc'); hgt700(:,:,:,20)=hgt(siz:sizbis,1,:,:);clear hgt;
35ncload('hgt700.1999.nc'); hgt700(:,:,:,21)=hgt(siz:sizbis,1,:,:);clear hgt;
36ncload('hgt700.2000.nc'); hgt700(:,:,:,22)=hgt(siz+1:sizbis+1,1,:,:);clear hgt;
37clear siz1 siz1bis;
38
39hgt=permute(hgt700,[1 4 2 3]);
40clear hgt700;
41
42status=load('eof2_olr_rossby_jjas.txt');
43% on met sous la forme annee mois
44olr_eof=reshape(eof2_olr_rossby_jjas,122,22);
45clear eof2_olr_rossby_jjas;
46
47% on calcule l ecart type sur la serie temporelle de l'olr
48k=122*22;
49olrbis=reshape(olr_eof,k,1);
50olrbis=std(olrbis);
51
52% intialisation des tableaux
53hgt700_filtre_compomax=NaN*ones(60,31,49,144);
54hgt700_filtre_compomin=NaN*ones(60,31,49,144);
55
56compteurmax=0;
57compteurmin=0;
58
59% boucle sur les annees
60for a=1:22;
61   clear delta;
62   delta=zeros(122,1);
63   % boucle sur les jours : on prepare avant
64   for b=1:122;
65        if b>1;
66            delta(b)=olr_eof(b,a)-olr_eof(b-1,a);
67        end;
68   end;
69   % boucle sur les jours
70   for b=1:122;
71      % 1ere condition (laisser une marge de 10)
72      if (b>20 && b<112);
73% cas 1 : max deltas apres negetifs et deltas avant postifs
74         if (delta(b+1)<0 && delta(b)<0 && delta(b-1)>0 && delta(b-2)>0 && olr_eof(b,a)>olrbis);
75            compteurmax=compteurmax+1;
76            hgt700_filtre_compomax(compteurmax,1,:,:)=hgt(b-20,a,:,:);
77            hgt700_filtre_compomax(compteurmax,2,:,:)=hgt(b-19,a,:,:);
78            hgt700_filtre_compomax(compteurmax,3,:,:)=hgt(b-18,a,:,:);
79            hgt700_filtre_compomax(compteurmax,4,:,:)=hgt(b-17,a,:,:);
80            hgt700_filtre_compomax(compteurmax,5,:,:)=hgt(b-16,a,:,:);
81            hgt700_filtre_compomax(compteurmax,6,:,:)=hgt(b-15,a,:,:);
82            hgt700_filtre_compomax(compteurmax,7,:,:)=hgt(b-14,a,:,:);
83            hgt700_filtre_compomax(compteurmax,8,:,:)=hgt(b-13,a,:,:);
84            hgt700_filtre_compomax(compteurmax,9,:,:)=hgt(b-12,a,:,:);
85            hgt700_filtre_compomax(compteurmax,10,:,:)=hgt(b-11,a,:,:);
86
87            hgt700_filtre_compomax(compteurmax,11,:,:)=hgt(b-10,a,:,:);
88            hgt700_filtre_compomax(compteurmax,12,:,:)=hgt(b-9,a,:,:);
89            hgt700_filtre_compomax(compteurmax,13,:,:)=hgt(b-8,a,:,:);
90            hgt700_filtre_compomax(compteurmax,14,:,:)=hgt(b-7,a,:,:);
91            hgt700_filtre_compomax(compteurmax,15,:,:)=hgt(b-6,a,:,:);
92            hgt700_filtre_compomax(compteurmax,16,:,:)=hgt(b-5,a,:,:);
93            hgt700_filtre_compomax(compteurmax,17,:,:)=hgt(b-4,a,:,:);
94            hgt700_filtre_compomax(compteurmax,18,:,:)=hgt(b-3,a,:,:);
95            hgt700_filtre_compomax(compteurmax,19,:,:)=hgt(b-2,a,:,:);
96            hgt700_filtre_compomax(compteurmax,20,:,:)=hgt(b-1,a,:,:);
97
98            hgt700_filtre_compomax(compteurmax,21,:,:)=hgt(b,a,:,:);
99            hgt700_filtre_compomax(compteurmax,22,:,:)=hgt(b+1,a,:,:);
100            hgt700_filtre_compomax(compteurmax,23,:,:)=hgt(b+2,a,:,:);
101            hgt700_filtre_compomax(compteurmax,24,:,:)=hgt(b+3,a,:,:);
102            hgt700_filtre_compomax(compteurmax,25,:,:)=hgt(b+4,a,:,:);
103            hgt700_filtre_compomax(compteurmax,26,:,:)=hgt(b+5,a,:,:);
104            hgt700_filtre_compomax(compteurmax,27,:,:)=hgt(b+6,a,:,:);
105            hgt700_filtre_compomax(compteurmax,28,:,:)=hgt(b+7,a,:,:);
106            hgt700_filtre_compomax(compteurmax,29,:,:)=hgt(b+8,a,:,:);
107            hgt700_filtre_compomax(compteurmax,30,:,:)=hgt(b+9,a,:,:);
108            hgt700_filtre_compomax(compteurmax,31,:,:)=hgt(b+10,a,:,:);
109% cas 2 : min deltas apres positifs et deltas avant negatifs
110         elseif (delta(b+1)>0 && delta(b)>0 && delta(b-1)<0 && delta(b-2)<0 && olr_eof(b,a)<(-olrbis));
111            compteurmin=compteurmin+1;
112
113            hgt700_filtre_compomin(compteurmin,1,:,:)=hgt(b-20,a,:,:);
114            hgt700_filtre_compomin(compteurmin,2,:,:)=hgt(b-19,a,:,:);
115            hgt700_filtre_compomin(compteurmin,3,:,:)=hgt(b-18,a,:,:);
116            hgt700_filtre_compomin(compteurmin,4,:,:)=hgt(b-17,a,:,:);
117            hgt700_filtre_compomin(compteurmin,5,:,:)=hgt(b-16,a,:,:);
118            hgt700_filtre_compomin(compteurmin,6,:,:)=hgt(b-15,a,:,:);
119            hgt700_filtre_compomin(compteurmin,7,:,:)=hgt(b-14,a,:,:);
120            hgt700_filtre_compomin(compteurmin,8,:,:)=hgt(b-13,a,:,:);
121            hgt700_filtre_compomin(compteurmin,9,:,:)=hgt(b-12,a,:,:);
122            hgt700_filtre_compomin(compteurmin,10,:,:)=hgt(b-11,a,:,:);
123
124            hgt700_filtre_compomin(compteurmin,11,:,:)=hgt(b-10,a,:,:);
125            hgt700_filtre_compomin(compteurmin,12,:,:)=hgt(b-9,a,:,:);
126            hgt700_filtre_compomin(compteurmin,13,:,:)=hgt(b-8,a,:,:);
127            hgt700_filtre_compomin(compteurmin,14,:,:)=hgt(b-7,a,:,:);
128            hgt700_filtre_compomin(compteurmin,15,:,:)=hgt(b-6,a,:,:);
129            hgt700_filtre_compomin(compteurmin,16,:,:)=hgt(b-5,a,:,:);
130            hgt700_filtre_compomin(compteurmin,17,:,:)=hgt(b-4,a,:,:);
131            hgt700_filtre_compomin(compteurmin,18,:,:)=hgt(b-3,a,:,:);
132            hgt700_filtre_compomin(compteurmin,19,:,:)=hgt(b-2,a,:,:);
133            hgt700_filtre_compomin(compteurmin,20,:,:)=hgt(b-1,a,:,:);
134
135            hgt700_filtre_compomin(compteurmin,21,:,:)=hgt(b,a,:,:);
136            hgt700_filtre_compomin(compteurmin,22,:,:)=hgt(b+1,a,:,:);
137            hgt700_filtre_compomin(compteurmin,23,:,:)=hgt(b+2,a,:,:);
138            hgt700_filtre_compomin(compteurmin,24,:,:)=hgt(b+3,a,:,:);
139            hgt700_filtre_compomin(compteurmin,25,:,:)=hgt(b+4,a,:,:);
140            hgt700_filtre_compomin(compteurmin,26,:,:)=hgt(b+5,a,:,:);
141            hgt700_filtre_compomin(compteurmin,27,:,:)=hgt(b+6,a,:,:);
142            hgt700_filtre_compomin(compteurmin,28,:,:)=hgt(b+7,a,:,:);
143            hgt700_filtre_compomin(compteurmin,29,:,:)=hgt(b+8,a,:,:);
144            hgt700_filtre_compomin(compteurmin,30,:,:)=hgt(b+9,a,:,:);
145            hgt700_filtre_compomin(compteurmin,31,:,:)=hgt(b+10,a,:,:);
146         end;
147      end;
148   end;
149end;
150
151% on fait la somme des valeurs de hgt700_filtreentiel sur le nbre d occurences
152% on obtent un tableau de la forme (jours-avant-apres,lon,lat)
153hgt700_filtre_compomin1(:,:,:)=nanmean(hgt700_filtre_compomin);
154clear hgt700_filtre_compomin;
155hgt700_filtre_compomax1(:,:,:)=nanmean(hgt700_filtre_compomax);
156clear hgt700_filtre_compomax;
157
158x=[-10:1:10]';
159
160figure(1);
161orient('landscape');
162lat=lat';
163pression=zeros(14,49,144);
164
165for e=1:7;
166       a=7-(e-1)+1;
167       f=2*(a-1)+1;
168       clear delta_hgt700_filtre_min;
169       delta_hgt700_filtre_min=zeros(49,144);
170       for b=1:49;
171          for c=1:144;
172             delta_hgt700_filtre_min(b,c)=hgt700_filtre_compomin1(f,b,c)-hgt700_filtre_compomax1(f,b,c);
173          end;
174       end;
175       for b=1:49;
176          for c=1:144;
177             if delta_hgt700_filtre_min(b,c)<-20;
178                  delta_hgt700_filtre_min(b,c)=-20;
179             elseif delta_hgt700_filtre_min(b,c)>20;
180                  delta_hgt700_filtre_min(b,c)=20;
181             end;
182          end;
183       end
184       subplot(7,1,8-e);
185       hold on;
186       palette
187       clear delta_hgt700;
188       delta_hgt700_filtre_min(1,1)=-20.0001;
189       delta_hgt700_filtre_min(1,2)=20.0001;
190       delta_hgt700=zeros(49,144);
191       delta_hgt700(:,1:72)=delta_hgt700_filtre_min(:,73:144);
192       delta_hgt700(:,73:144)=delta_hgt700_filtre_min(:,1:72);
193       pression(e,:,:)=delta_hgt700;
194       aa=contourf(lon-180,lat,delta_hgt700,[-20:2:20],'LineStyle','none');
195       if e==1;
196         set (gca,'XTick',[-180:60:180],'XTickLabel',[' 180';'120W';' 60W';'   0';' 60E';'120E';' 180'],'fontname','Arial','fontsize',6);
197       else
198         set (gca,'XTick',[-180:60:180],'XTickLabel',[' ';' ';' ';' ';' ';' '],'fontname','Arial','fontsize',6);
199       end;
200       set (gca,'YTick',[-10:10:40],'YTickLabel',['   ';'  0';'10N';'20N';'30N';'   '],'fontname','Arial','fontsize',6);
201       if e==4;
202          co=colorbar;
203          set (co,'xtick',[-20:10:20],'xticklabel',[-20:10:20],'fontname','Arial','fontsize',6);
204       end;
205       hold on;
206       cartemonde1;
207       set (gca,'tickDir','out');
208       axis equal;
209       axis([-180 180 -10 40]);
210       if e==7;
211           title('EOF2 filtre Rossby','fontsize',8);
212       end;
213       text(-270,10,['day = ',num2str(f-21)],'fontname','Arial','fontsize',10);
214       pos_vert=e/10;
215       set (gca,'position',[0.2 pos_vert 0.5 0.1]);
216end;
217
218%%%%%%%%%%%%%%%%%%%%
219figure(2)
220orient('landscape')
221
222for e=1:7;
223       a=7-(e-1)+1+7;
224       f=2*(a-1)+1;
225       clear delta_hgt700_filtre_min;
226       delta_hgt700_filtre_min=zeros(49,144);
227       for b=1:49;
228          for c=1:144;
229             delta_hgt700_filtre_min(b,c)=hgt700_filtre_compomin1(f,b,c)-hgt700_filtre_compomax1(f,b,c);
230          end;
231       end;
232       for b=1:49;
233          for c=1:144;
234             if delta_hgt700_filtre_min(b,c)<-20;
235                  delta_hgt700_filtre_min(b,c)=-20;
236             elseif delta_hgt700_filtre_min(b,c)>20;
237                  delta_hgt700_filtre_min(b,c)=20;
238             end;
239          end;
240       end;
241       subplot(7,1,8-e);
242       hold on;
243       palette
244       delta_hgt700_filtre_min(1,1)=-20.0001;
245       delta_hgt700_filtre_min(1,2)=20.0001;
246       clear delta_hgt700;
247       delta_hgt700_filtre_min(1,1)=-20.0001;
248       delta_hgt700_filtre_min(1,2)=20.0001;
249       delta_hgt700=zeros(49,144);
250       delta_hgt700(:,1:72)=delta_hgt700_filtre_min(:,73:144);
251       delta_hgt700(:,73:144)=delta_hgt700_filtre_min(:,1:72);
252       pression(e+7,:,:)=delta_hgt700;
253       aa=contourf(lon-180,lat,delta_hgt700,[-20:2:20],'LineStyle','none');
254       if e==1;
255       set (gca,'XTick',[-180:60:180],'XTickLabel',[' 180';'120W';' 60W';'   0';' 60E';'120E';' 180'],'fontname','Arial','fontsize',6);
256       else
257      set (gca,'XTick',[-180:60:180],'XTickLabel',[' ';' ';' ';' ';' ';' '],'fontname','Arial','fontsize',6);
258       end
259       set (gca,'YTick',[-10:10:40],'YTickLabel',['   ';'  0';'10N';'20N';'30N';'   '],'fontname','Arial','fontsize',6);
260       if e==4;
261          co=colorbar;
262          set (co,'xtick',[-20:10:20],'xticklabel',[-20:10:20],'fontname','Arial','fontsize',5);
263       end;
264       hold on;
265       cartemonde1;
266       set (gca,'tickDir','out');
267       axis equal
268       axis([-180 180 -10 40]);
269       if e==7;
270           title('EOF2 filtre Rossby','fontsize',8) ;
271       end
272       text(-270,10,['day = ',num2str(f-21)],'fontname','Arial','fontsize',10);
273       pos_vert=e/10;
274       set (gca,'position',[0.2 pos_vert 0.5 0.1])
275end;
276
277status=save('pression.mat','pression;');
Note: See TracBrowser for help on using the repository browser.