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

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

parametrisation of time_serie_jjas_....m and composite_olr_EOF1....m

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