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

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

parametrisation of composite_olr_phase....m; some unparametrized files in obsolete directory

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