source: trunk/src/mode_sahelien/composite_olr_phase_num.m @ 42

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

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

File size: 7.9 KB
Line 
1function composite_olr_phase_num(phase_num)
2% composite_olr_phase_num ++explication between 1 and 8
3
4%+
5% module
6% ======
7%
8% ++
9%
10% DESCRIPTION
11% ===========
12%
13% From ``olr.day.mean.nc`` and phase\ *phase_num*\ .txt, composite_olr_phase_num
14% compute ++, plot ++
15%
16% CAUTIONS
17% ========
18%
19% Need Statistics_Toolbox because of nanmean
20%
21% can't work with octave because of ncload and nanmean
22%
23% EXAMPLES
24% ========
25%
26% Following line read olr.day.mean.nc and phase\ *phase_num*\ .txt, compute ++,
27% plot ++
28% ::
29%
30% >> composite_olr_phase_num(1);
31%
32% SEE ALSO
33% ========
34%
35%
36% lagged_correlations_eof2_eof3_1030.m_
37%
38% .. _lagged_correlations_eof2_eof3_1030.m : lagged_correlations_eof2_eof3_1030.m.html
39%
40% composite_olr_phase.m_
41%
42% .. _composite_olr_phase.m : composite_olr_phase.m.html
43%
44% time_serie_histog_phase.m_
45%
46% .. _time_serie_histog_phase.m : time_serie_histog_phase.m.html
47%
48% time_serie_histog_phase_num.m_
49%
50% .. _time_serie_histog_phase_num.m : time_serie_histog_phase_num.m.html
51%
52% TODO
53% ====
54%
55% improve description
56%
57% improve file pb
58%
59% use return function
60%
61% externalize time selection on olr.day.mean.nc
62%
63% test at the beginning if Statistics_Toolbox  available
64%
65% test at the beginning if octave is running
66%
67% EVOLUTIONS
68% ==========
69%
70% $Id$
71%
72% - fplod 2009-01-28T10:38:44Z aedon.locean-ipsl.upmc.fr (Darwin)
73%
74%   * created from composite_olr_phase8.m to replace it as well as
75%     composite_olr_phase[1-7].m
76%
77%-
78
79global IRCAAM_ID;
80global IRCAAM_OD;
81
82phase_num_min=1;
83phase_num_max=8;
84
85if nargin==1
86 % phase_num must be greater or equal to 1 and lower or equal to 8
87 if ((phase_num < phase_num_min) || (phase_num > phase_num_max))
88  disp(['phase_num_min = ', int2str(phase_num_min)]);
89  disp(['phase_num_max = ', int2str(phase_num_max)]);
90  error('eee : phase_num must be between phase_num_min and phase_num_max');
91 end
92else
93  usage='usage : composite_olr_phase_num(phase_num)';
94  disp(usage);
95  error('eee : wrong arguments numbers')
96end
97
98fullfilename=[IRCAAM_ID,'olr.day.mean.nc'];
99ncload(fullfilename);
100clear fullfilename;
101
102% taille 12327x73x144 1er juin 1974-31 decembre2007
103% on enleve les annees 1974 a 1978 nombre de jours a enlever au debut 214+365+366+365+365
104% on enleve les annees 2001 a 2008 nombre de jours a enlever au debut 12327-(365*3+366+365*3+60)
105
106debut=214+365+366+365+365;
107fin=12327-(365+60);
108olr=olr(debut:fin,21:41,:);
109siz=fin-debut+1;
110for a=1:21;
111   for b=1:144;
112       for c=1:siz;
113          if olr(c,a,b)==32766;
114              olr(c,a,b)=NaN;
115          end;
116       end ;
117   end;
118end;
119olr=olr*0.01+327.65;
120olr1=zeros(siz,21,144);
121olr1(:,:,1:72)=olr(:,:,73:144);
122olr1(:,:,73:144)=olr(:,:,1:72);
123clear olr;
124
125% on permture le temps et l'espce
126% nouvelles dimentions
127% 21 144 siz
128olr1=permute(olr1, [2 3 1]);
129
130for a=1:21;
131   for b=1:144;
132      clear vecteur
133      vecteur=zeros(siz,1);
134      for c=1:siz;
135           vecteur(c)=olr1(a,b,c);
136      end;
137      std_c=nanmean(vecteur);
138      for c=1:siz;
139          olr1(a,b,c)=olr1(a,b,c)-std_c;
140      end;
141   end;
142end;
143
144% on met sous la forme longitude latitude jour
145
146% on selectionne les mois d ete (attention aux annees bixestiles!)
147
148siz1=31+28+31+30+31+1;
149siz1bis=31+28+31+30+31+30+31+31+30;
150a=siz1bis-siz1;
151
152olr=zeros(21,144,122,28);
153
154siz2=siz1+366; siz2bis=siz2+a; % 1980
155siz3=siz2+365; siz3bis=siz3+a; % 1981
156siz4=siz3+365; siz4bis=siz4+a; % 1982
157siz5=siz4+365; siz5bis=siz5+a; % 1983
158siz6=siz5+366; siz6bis=siz6+a; % 1984
159siz7=siz6+365; siz7bis=siz7+a; % 1985
160siz8=siz7+365; siz8bis=siz8+a; % 1986
161siz9=siz8+365; siz9bis=siz9+a; % 1987
162siz10=siz9+366; siz10bis=siz10+a; % 1988
163siz11=siz10+365; siz11bis=siz11+a; % 1989
164siz12=siz11+365; siz12bis=siz12+a; % 1990
165siz13=siz12+365; siz13bis=siz13+a; % 1991
166siz14=siz13+366; siz14bis=siz14+a; % 1992
167siz15=siz14+365; siz15bis=siz15+a; % 1993
168siz16=siz15+365; siz16bis=siz16+a; % 1994
169siz17=siz16+365; siz17bis=siz17+a; % 1995
170siz18=siz17+366; siz18bis=siz18+a; % 1996
171siz19=siz18+365; siz19bis=siz19+a; % 1997
172siz20=siz19+365; siz20bis=siz20+a; % 1998
173siz21=siz20+365; siz21bis=siz21+a; % 1999
174siz22=siz21+366; siz22bis=siz22+a; % 2000
175siz23=siz22+365; siz23bis=siz23+a; % 2001
176siz24=siz23+365; siz24bis=siz24+a; % 2002
177siz25=siz24+365; siz25bis=siz25+a; % 2003
178siz26=siz25+366; siz26bis=siz26+a; % 2004
179siz27=siz26+365; siz27bis=siz27+a; % 2005
180siz28=siz27+365; siz28bis=siz28+a; % 2006
181
182olr(:,:,:,1)=olr1(:,:,siz1:siz1bis); % 1979
183olr(:,:,:,2)=olr1(:,:,siz2:siz2bis); % 1980
184olr(:,:,:,3)=olr1(:,:,siz3:siz3bis); % 1981
185olr(:,:,:,4)=olr1(:,:,siz4:siz4bis); % 1982
186olr(:,:,:,5)=olr1(:,:,siz5:siz5bis); % 1983
187olr(:,:,:,6)=olr1(:,:,siz6:siz6bis); % 1984
188olr(:,:,:,7)=olr1(:,:,siz7:siz7bis); % 1985
189olr(:,:,:,8)=olr1(:,:,siz8:siz8bis); % 1986
190olr(:,:,:,9)=olr1(:,:,siz9:siz9bis); % 1987
191olr(:,:,:,10)=olr1(:,:,siz10:siz10bis); % 1988
192olr(:,:,:,11)=olr1(:,:,siz11:siz11bis); % 1989
193olr(:,:,:,12)=olr1(:,:,siz12:siz12bis); % 1990
194olr(:,:,:,13)=olr1(:,:,siz13:siz13bis); % 1991
195olr(:,:,:,14)=olr1(:,:,siz14:siz14bis); % 1992
196olr(:,:,:,15)=olr1(:,:,siz15:siz15bis); % 1993
197olr(:,:,:,16)=olr1(:,:,siz16:siz16bis); % 1994
198olr(:,:,:,17)=olr1(:,:,siz17:siz17bis); % 1995
199olr(:,:,:,18)=olr1(:,:,siz18:siz18bis); % 1996
200olr(:,:,:,19)=olr1(:,:,siz19:siz19bis); % 1997
201olr(:,:,:,20)=olr1(:,:,siz20:siz20bis); % 1998
202olr(:,:,:,21)=olr1(:,:,siz21:siz21bis); % 1999
203olr(:,:,:,22)=olr1(:,:,siz22:siz22bis); % 2000
204olr(:,:,:,23)=olr1(:,:,siz23:siz23bis); % 2001
205olr(:,:,:,24)=olr1(:,:,siz24:siz24bis); % 2002
206olr(:,:,:,25)=olr1(:,:,siz25:siz25bis); % 2003
207olr(:,:,:,26)=olr1(:,:,siz26:siz26bis); % 2004
208olr(:,:,:,27)=olr1(:,:,siz27:siz27bis); % 2005
209olr(:,:,:,28)=olr1(:,:,siz28:siz28bis); % 2006
210
211clear siz1 siz1bis;
212clear siz2 siz2bis;
213clear siz3 siz3bis;
214clear siz4 siz4bis;
215clear siz5 siz5bis;
216clear siz6 siz6bis;
217clear siz7 siz7bis;
218clear siz8 siz8bis;
219clear siz9 siz9bis;
220clear siz10 siz10bis;
221clear siz11 siz11bis;
222clear siz12 siz12bis;
223clear siz13 siz13bis;
224clear siz14 siz14bis;
225clear siz15 siz15bis;
226clear siz16 siz16bis;
227clear siz17 siz17bis;
228clear siz18 siz18bis;
229clear siz19 siz19bis;
230clear siz20 siz20bis;
231clear siz21 siz21bis;
232clear siz22 siz22bis;
233clear siz23 siz23bis;
234clear siz24 siz24bis;
235clear siz25 siz25bis;
236clear siz26 siz26bis;
237clear siz27 siz27bis;
238clear siz28 siz28bis;
239
240%olr=zeros(21,144,122,28);
241olr1=permute(olr,[3 4 1 2]);
242clear olr;
243olr2=reshape(olr1,3416,21,144);
244olr3(:,:)=mean(olr2);
245clear olr2;
246
247fullfilename=[IRCAAM_OD,'phase',int2str(phase_num),'.txt'];
248status=load(fullfilename);
249clear fullfilename;
250
251phase=status;
252clear status;
253phase=reshape(phase,122,28,3);
254olr_filtre_compomax=zeros(90,21,144);
255compteurmax=0;
256
257% boucle sur les annees
258for a=1:28;
259   % boucle sur les jours
260   for b=1:122;
261      % 1ere condition (laisser une marge de 10)
262      if (b>11 && b<112);
263         if phase(b,a,1)==1;
264            compteurmax=compteurmax+1;
265            olr_filtre_compomax(compteurmax,:,:)=olr1(b,a,:,:);
266         end;
267      end;
268   end;
269end;
270disp(['iii : compteurmax =', int2str(compteurmax)]);
271% on ne selectionne que la partie du tableau ou il y a des valeurs
272olr_filtre_compomax=olr_filtre_compomax(1:compteurmax,:,:);
273
274% on fait la somme des valeurs de olr_filtreentiel sur le nbre d occurences
275% on obtent un tableau de la forme (jours-avant-apres,lon,lat)
276olr_filtre_compomax1(:,:)=mean(olr_filtre_compomax);
277clear olr_filtre_compomax;
278
279x=[-10:1:10]';
280
281lat=lat(21:41)';
282lon=lon-180;
283delta=olr_filtre_compomax1-olr3;
284clear olr3;
285for b=1:21;
286    for c=1:144;
287       if delta(b,c)<-50;
288          delta(b,c)=-50;
289       elseif delta(b,c)>50;
290           delta(b,c)=50;
291       end;
292    end;
293end;
294palette;
295delta(1,1)=-50.0001;
296delta(1,2)=50.0001;
297aa=contourf(lon,lat,delta,[-50:5:50],'LineStyle','none');
298set (gca,'XTick',[-180:60:180],'XTickLabel',[' 180';'120W';' 60W';'   0';' 60E';'120E';' 180'],'fontsize',6);
299set (gca,'YTick',[-10:10:40],'YTickLabel',['   ';'  0';'10N';'20N';'30N';'   '],'fontname','Arial','fontsize',6);
300co=colorbar;
301set(co,'xtick',[-20:10:20],'xticklabel',[-20:10:20],'fontname','Arial','fontsize',6);
302hold on;
303cartemonde1;
304set (gca,'tickDir','out');
305axis equal;
306axis([-180 180 -10 40]);
Note: See TracBrowser for help on using the repository browser.