source: trunk/src/mode_sahelien/time_serie_histog_phase7.m @ 40

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

correction of usage of print function, fix side effect of load function

File size: 4.1 KB
Line 
1%
2
3clear;
4status=load('phase7.txt');
5phase7=status;
6clear status;
7phase7=reshape(phase7,122,28,3);
8
9%%%%%%%%%%%% FICHIER TYPE DE TEMPS
10% on ouvre le fichier
11status=load('occu.txt');
12occu=status;
13clear status;
14
15% on reorganise le fichier de type de temps (jours,annees,cluster)
16y=reshape(occu,122,58,4);
17clear occu;
18
19% on selectionne les annees de 1979 a 2006
20occu_type_tps(:,:,:)=y(:,30:57,:);
21clear y;
22
23% intialisation des tableaux
24type_temps_compomax=zeros(80,21,4);
25compteurmax=0;
26
27% boucle sur les annees
28for a=1:28;
29   for b=1:122;
30      % 1ere condition (laisser une marge de 10)
31      if (b>11 && b<112);
32%        condition 1 on est a un maximum deltas apres sont negetifs et
33%             delta avant postifs
34         if phase7(b,a,1)==1;
35            compteurmax=compteurmax+1;
36            type_temps_compomax(compteurmax,1,:)=occu_type_tps(b-10,a,:);
37            type_temps_compomax(compteurmax,2,:)=occu_type_tps(b-9,a,:);
38            type_temps_compomax(compteurmax,3,:)=occu_type_tps(b-8,a,:);
39            type_temps_compomax(compteurmax,4,:)=occu_type_tps(b-7,a,:);
40            type_temps_compomax(compteurmax,5,:)=occu_type_tps(b-6,a,:);
41            type_temps_compomax(compteurmax,6,:)=occu_type_tps(b-5,a,:);
42            type_temps_compomax(compteurmax,7,:)=occu_type_tps(b-4,a,:);
43            type_temps_compomax(compteurmax,8,:)=occu_type_tps(b-3,a,:);
44            type_temps_compomax(compteurmax,9,:)=occu_type_tps(b-2,a,:);
45            type_temps_compomax(compteurmax,10,:)=occu_type_tps(b-1,a,:);
46            type_temps_compomax(compteurmax,11,:)=occu_type_tps(b,a,:);
47            type_temps_compomax(compteurmax,12,:)=occu_type_tps(b+1,a,:);
48            type_temps_compomax(compteurmax,13,:)=occu_type_tps(b+2,a,:);
49            type_temps_compomax(compteurmax,14,:)=occu_type_tps(b+3,a,:);
50            type_temps_compomax(compteurmax,15,:)=occu_type_tps(b+4,a,:);
51            type_temps_compomax(compteurmax,16,:)=occu_type_tps(b+5,a,:);
52            type_temps_compomax(compteurmax,17,:)=occu_type_tps(b+6,a,:);
53            type_temps_compomax(compteurmax,18,:)=occu_type_tps(b+7,a,:);
54            type_temps_compomax(compteurmax,19,:)=occu_type_tps(b+8,a,:);
55            type_temps_compomax(compteurmax,20,:)=occu_type_tps(b+9,a,:);
56            type_temps_compomax(compteurmax,21,:)=occu_type_tps(b+10,a,:);
57         end;
58      end;
59   end;
60end;
61
62% on ne selectionne que la partie du tableau ou il y a des valeurs
63type_temps_compomax=type_temps_compomax(1:compteurmax,:,:);
64
65type_temps_moy=reshape(occu_type_tps,3416,4);
66disp(['iii : compteurmax =', int2str(compteurmax)]);
67% on fait la somme des types de temps sur toute la periode de temps
68% on obtent un tableau de la forme (jours-avant-apres,cluster)
69
70type_temps_compomax1(:,:)=sum(type_temps_compomax);
71type_temps_moy=sum(type_temps_moy);
72
73clear type_temps_compomax;
74
75% on fait la somme => le nbre de jour avec 1 type de temps persistant
76% pour chaque jour
77sum_kara_max=sum((type_temps_compomax1)');
78
79% on traduit le nbre d occurence en frequences relatives
80kara_max=zeros(21,4);
81kara_moy=zeros(21,4);
82for a=1:21;
83   for b=1:4;
84      kara_max(a,b)=type_temps_compomax1(a,b)/sum_kara_max(a);
85      kara_moy(b)=type_temps_moy(b)/3416;
86   end;
87end;
88
89x=[-10:1:10]';
90kara_diff=zeros(21,4);
91for a=1:21;
92    for b=1:4
93       kara_diff(a,b)=kara_max(a,b)-kara_moy(b);
94    end;
95end;
96
97for a=1:4;
98    subplot(4,4,a+8);
99    diff=kara_diff(:,a)*100;
100    jour=[-10:10]';
101    if a==1;
102       bar(jour,diff,'r');
103       c=[1 0.55 0];
104       bar(jour,diff),colormap(c);
105    elseif a==2;
106       bar(jour,diff,'g');
107    elseif a==3;
108       bar(jour,diff,'b');
109    else
110       bar(jour,diff,'r');
111    end;
112    set (gca,'XTick',[-10:2:10],'XTickLabel',[-10:2:10],'fontname','Arial','fontsize',6);
113    set (gca,'YTick',[-20:10:20],'YTickLabel',[-20:5:20],'fontname','Arial','fontsize',6);
114    axis([-10 10 -20 20]);
115    set (gca,'tickDir','out');
116    if a==1;
117       title('Atl low','Fontsize',8,'Fontname','Arial');
118       text(-20,0,'Phase7');
119    elseif a==2;
120       title('Atl Ridge','Fontsize',8,'Fontname','Arial');
121    elseif a==3;
122       title('NAO-','Fontsize',8,'Fontname','Arial');
123    else
124       title('Blocking','Fontsize',8,'Fontname','Arial');
125    end;
126end;
Note: See TracBrowser for help on using the repository browser.