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

Last change on this file since 71 was 71, checked in by pinsard, 14 years ago

add man troff output of manuals and some light modification in sources due to docutils upgrade (0.6); warning : new troubles with target

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