source: trunk/src/mode_sahelien/composite_hgt925_sahel.m @ 30

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

correction of usage of save function

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