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

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

replace fcommands save, load and print by function calls

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