source: trunk/src/mode_sahelien/time_serie_histog_phase_num.m @ 41

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

parametrisation of time_serie_histog_phase....m

File size: 5.8 KB
Line 
1function time_serie_histog_phase_num(phase_num)
2% time_serie_histog_phase_num ++explication between 1 and 8
3
4%+
5% module
6% ======
7%
8% ++
9%
10% DESCRIPTION
11% ===========
12%
13% From occu.txt and phase``phase_num``.txt, time_serie_histog_phase_num plots
14% for each WT ++.
15%
16% EXAMPLES
17% ========
18%
19% Following line read phase1.txt and occu.txt and plots for each WT ++
20% ::
21%
22% >> time_serie_histog_phase_num(1);
23%
24% SEE ALSO
25% ========
26%
27%
28% composite_olr_phase1.m_
29%
30% .. _composite_olr_phase1.m : composite_olr_phase1.m.html
31%
32% time_serie_histog_phase.m_
33%
34% .. _time_serie_histog_phase.m : time_serie_histog_phase.m.html
35%
36% TODO
37% ====
38%
39% improve description
40%
41% improve file pb
42%
43% use return function
44%
45% EVOLUTIONS
46% ==========
47%
48% $Id$
49%
50% - fplod 2009-01-28T09:01:45Z aedon.locean-ipsl.upmc.fr (Darwin)
51%
52%   * created from time_serie_histog_phase1.m to replace it as well as
53%     time_serie_histog_phase[2-8].m
54%
55%-
56
57global IRCAAM_ID;
58
59phase_num_min=1;
60phase_num_max=8;
61
62if nargin==1
63 % phase_num must be greater or equal to 1 and lower or equal to 8
64 if ((phase_num < phase_num_min) || (phase_num > phase_num_max))
65  disp(['phase_num_min = ', int2str(phase_num_min)]);
66  disp(['phase_num_max = ', int2str(phase_num_max)]);
67  error('eee : phase_num must be between phase_num_min and phase_num_max');
68 end
69else
70  usage='usage : time_serie_histog_phase_num(phase_num)';
71  disp(usage);
72  error('eee : wrong arguments numbers')
73end
74
75fullfilename=[IRCAAM_ID,'phase',int2str(phase_num),'.txt'];
76status=load(fullfilename);
77clear fullfilename;
78
79phase=status;
80clear status;
81phase=reshape(phase,122,28,3);
82
83%%%%%%%%%%%% FICHIER TYPE DE TEMPS
84% on ouvre le fichier
85fullfilename=[IRCAAM_ID,'occu.txt'];
86status=load(fullfilename);
87clear fullfilename;
88occu=status;
89clear status;
90
91% on reorganise le fichier de type de temps (jours,annees,cluster)
92y=reshape(occu,122,58,4);
93clear occu;
94
95% on selectionne les annees de 1979 a 2006
96occu_type_tps(:,:,:)=y(:,30:57,:);
97clear y;
98
99% intialisation des tableaux
100type_temps_compomax=zeros(80,21,4);
101compteurmax=0;
102
103% boucle sur les annees
104for a=1:28;
105   for b=1:122;
106      % 1ere condition (laisser une marge de 10)
107      if (b>11 && b<112);
108%        condition 1 on est a un maximum deltas apres sont negetifs et
109%             delta avant postifs
110         if phase(b,a,1)==1;
111            compteurmax=compteurmax+1;
112            type_temps_compomax(compteurmax,1,:)=occu_type_tps(b-10,a,:);
113            type_temps_compomax(compteurmax,2,:)=occu_type_tps(b-9,a,:);
114            type_temps_compomax(compteurmax,3,:)=occu_type_tps(b-8,a,:);
115            type_temps_compomax(compteurmax,4,:)=occu_type_tps(b-7,a,:);
116            type_temps_compomax(compteurmax,5,:)=occu_type_tps(b-6,a,:);
117            type_temps_compomax(compteurmax,6,:)=occu_type_tps(b-5,a,:);
118            type_temps_compomax(compteurmax,7,:)=occu_type_tps(b-4,a,:);
119            type_temps_compomax(compteurmax,8,:)=occu_type_tps(b-3,a,:);
120            type_temps_compomax(compteurmax,9,:)=occu_type_tps(b-2,a,:);
121            type_temps_compomax(compteurmax,10,:)=occu_type_tps(b-1,a,:);
122            type_temps_compomax(compteurmax,11,:)=occu_type_tps(b,a,:);
123            type_temps_compomax(compteurmax,12,:)=occu_type_tps(b+1,a,:);
124            type_temps_compomax(compteurmax,13,:)=occu_type_tps(b+2,a,:);
125            type_temps_compomax(compteurmax,14,:)=occu_type_tps(b+3,a,:);
126            type_temps_compomax(compteurmax,15,:)=occu_type_tps(b+4,a,:);
127            type_temps_compomax(compteurmax,16,:)=occu_type_tps(b+5,a,:);
128            type_temps_compomax(compteurmax,17,:)=occu_type_tps(b+6,a,:);
129            type_temps_compomax(compteurmax,18,:)=occu_type_tps(b+7,a,:);
130            type_temps_compomax(compteurmax,19,:)=occu_type_tps(b+8,a,:);
131            type_temps_compomax(compteurmax,20,:)=occu_type_tps(b+9,a,:);
132            type_temps_compomax(compteurmax,21,:)=occu_type_tps(b+10,a,:);
133         end;
134      end;
135   end;
136end;
137
138% on ne selectionne que la partie du tableau ou il y a des valeurs
139type_temps_compomax=type_temps_compomax(1:compteurmax,:,:);
140
141type_temps_moy=reshape(occu_type_tps,3416,4);
142disp(['iii : compteurmax =', int2str(compteurmax)]);
143% on fait la somme des types de temps sur toute la periode de temps
144% on obtent un tableau de la forme (jours-avant-apres,cluster)
145
146type_temps_compomax1(:,:)=sum(type_temps_compomax);
147type_temps_moy=sum(type_temps_moy);
148
149clear type_temps_compomax;
150
151% on fait la somme => le nbre de jour avec 1 type de temps persistant
152% pour chaque jour
153sum_kara_max=sum((type_temps_compomax1)');
154
155% on traduit le nbre d occurence en frequences relatives
156kara_max=zeros(21,4);
157kara_moy=zeros(21,4);
158for a=1:21;
159   for b=1:4;
160      kara_max(a,b)=type_temps_compomax1(a,b)/sum_kara_max(a);
161      kara_moy(b)=type_temps_moy(b)/3416;
162   end;
163end;
164
165x=[-10:1:10]';
166kara_diff=zeros(21,4);
167for a=1:21;
168    for b=1:4
169       kara_diff(a,b)=kara_max(a,b)-kara_moy(b);
170    end;
171end;
172
173offset=mod(phase_num-1,4)*4;
174for a=1:4;
175    subplot(4,4,a+offset);
176    diff=kara_diff(:,a)*100;
177    jour=[-10:10]';
178    if a==1;
179       bar(jour,diff,'r');
180       c=[1 0.55 0];
181       bar(jour,diff),colormap(c);
182    elseif a==2;
183       bar(jour,diff,'g');
184    elseif a==3;
185       bar(jour,diff,'b');
186    else
187       bar(jour,diff,'r');
188    end;
189    set (gca,'XTick',[-10:2:10],'XTickLabel',[-10:2:10],'fontname','Arial','fontsize',6);
190    set (gca,'YTick',[-20:10:20],'YTickLabel',[-20:5:20],'fontname','Arial','fontsize',6);
191    axis([-10 10 -20 20]);
192    set (gca,'tickDir','out');
193    if a==1;
194       title('Atl low','Fontsize',8,'Fontname','Arial');
195       ylabel=['Phase ' int2str(phase_num)];
196       text(-20,0,ylabel);
197       clear ylabel;
198    elseif a==2;
199       title('Atl Ridge','Fontsize',8,'Fontname','Arial');
200    elseif a==3;
201       title('NAO-','Fontsize',8,'Fontname','Arial');
202    else
203       title('Blocking','Fontsize',8,'Fontname','Arial');
204    end;
205end;
206clear offset;
Note: See TracBrowser for help on using the repository browser.