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