source: trunk/src/mode_sahelien/carte_eof234_jjas_df.m @ 75

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

improvements of headers and unset in shell scripts

File size: 6.6 KB
Line 
1function carte_eof234_jjas_df(period1, period2)
2% carte_eof234_jjas_df ++explication between period1 days and period2 days
3
4%+
5% ======================
6% carte_eof234_jjas_df.m
7% ======================
8%
9% ++
10%
11% DESCRIPTION
12% ===========
13%
14% plot ++ from file eof_10-30d_jjas.mat
15%
16% EXAMPLES
17% ========
18%
19% Following line read eof_10-30d_jjas.mat, plot ++and produce a Postcript file
20% resultats_eof_jjas_2006_10-30d.eps
21% produce also carte_eofx_mode_sahel_10-30d.dat and
22% carte_eofx_mode_sahel_10-30d.ctl (GRADS files) and vecteurs_eof_10-30d.txt.
23% ::
24%
25% >> carte_eof234_jjas_df(10,30);
26%
27% SEE ALSO
28% ========
29%
30% olr_eof_1025.m_
31%
32% .. _olr_eof_1025.m : olr_eof_1025.m.html
33%
34% reconstitution_1025.m_
35%
36% .. _reconstitution_1025.m : reconstitution_1025.m.html
37%
38% time_serie_jjas_10_25.m_
39%
40% .. _time_serie_jjas_10_25.m : time_serie_jjas_10_25.m.html
41%
42% sauvegrads.m_
43%
44% .. _sauvegrads.m : sauvegrads.m.html
45%
46% TODO
47% ====
48%
49% improve description
50%
51% improve file pb
52%
53% use return function
54%
55% change filename of Postscript file because same as in carte_eof_ER_jjas_df.m
56%
57% directory for sauvegrads files
58%
59% control of sauvegrads call
60%
61% why ``-carte`` in contourf and sauvegrads instead of ``carte`` ?
62%
63% EVOLUTIONS
64% ==========
65%
66% $Id$
67%
68% - fplod 2009-02-11T16:27:34Z aedon.locean-ipsl.upmc.fr (Darwin)
69%
70%   * add try/catch on opening file for reading
71%
72% - fplod 2009-02-10T14:28:00Z aedon.locean-ipsl.upmc.fr (Darwin)
73%
74%   * replace ndmin by period1 and ndmax by period2
75%
76% - fplod 2009-01-27T14:49:51Z aedon.locean-ipsl.upmc.fr (Darwin)
77%
78%   * created from carte_eof234_jjas_1025.m and carte_eof234_jjas_1030.m
79%     to replace both.
80%
81%     Days will be now written ``period1``\-``period2d`` (ex: 10-30d) in filenames.
82%
83%   *  add sauvegrads on first EOF for homogenity
84%
85%-
86
87
88global IRCAAM_ID;
89global IRCAAM_OD;
90
91if nargin==2
92 % period1 must be lower than period2
93 if (period1 > period2)
94  disp(['period1 = ', int2str(period1)]);
95  disp(['period2 = ', int2str(period2)]);
96  error('eee : period1 must be lower than period2');
97 end
98else
99  usage='usage : carte_eof234_jjas_df(period1, period2)';
100  disp(usage);
101  error('eee : wrong arguments numbers')
102end
103
104% period1 and period2 will be used in xx-yyd form in filenames
105df = [int2str(period1),'-',int2str(period2),'d'];
106clear period1;
107clear period2;
108
109
110fullfilename=[IRCAAM_ID,'eof_',df,'_jjas.mat'];
111try
112 status=load(fullfilename,'C','L');
113catch
114 error('eee : File %s not found\n', fullfilename);
115end
116
117clear fullfilename;
118
119C=status.C;
120L=status.L;
121clear status;
122
123carte1=C(:,425);
124
125carte=reshape(carte1,25,17);
126carte=carte';
127
128clear carte1;
129% defintion des lat et lon
130lon=[-30:2.5:30]';
131lat=[-10:2.5:30];
132
133figure(1);
134orient('landscape');
135subplot(3,2,1);
136palette;
137for a=1:17;
138    for b=1:25;
139        if carte(a,b)>0.2;
140            carte(a,b)=0.2;
141        elseif carte(a,b)<-0.2;
142            carte(a,b)=-0.2;
143        end;
144    end;
145end;
146carte(1,1)=-0.2001;
147carte(1,2)=0.2001;
148
149contourf(lon,lat,-carte,[-0.2:0.02:0.2],'LineStyle','none');
150gradsname=['carte_eof1_mode_sahel_',df];
151sauvegrads(gradsname,-carte,[-30 2.5 -10 2.5]);
152clear gradsname;
153
154colorbar;
155title('OLR EOF1','Fontsize',8);
156hold on;
157cartemonde;
158set (gca,'YTick',[-10:10:30],'YTickLabel',['10S';'  0';'10N';'20N';'30N'],'fontname','Arial','fontsize',6);
159set (gca,'XTick',[-30:10:30],'XTickLabel',['30W';'20W';'10W';'  0';'10E';'20E';'30E'],'fontname','Arial','fontsize',6);
160set (gca,'tickDir','out');
161
162clear carte1 x y a b carte coco;
163carte1=C(:,424);
164carte=reshape(carte1,25,17);
165carte=carte';
166
167clear carte1;
168lon=[-30:2.5:30]';
169lat=[-10:2.5:30];
170
171subplot(3,2,3);
172palette;
173for a=1:17;
174    for b=1:25;
175        if carte(a,b)>0.2;
176            carte(a,b)=0.2;
177        elseif carte(a,b)<-0.2;
178            carte(a,b)=-0.2;
179        end;
180    end;
181end;
182carte(1,1)=-0.2001;
183carte(1,2)=0.2001;
184
185contourf(lon,lat,-carte,[-0.2:0.02:0.2],'LineStyle','none');
186gradsname=['carte_eof2_mode_sahel_',df];
187sauvegrads(gradsname,-carte,[-30 2.5 -10 2.5]);
188clear gradsname;
189colorbar;
190
191title('OLR EOF2','Fontsize',8);
192hold on;
193cartemonde;
194set (gca,'YTick',[-10:10:30],'YTickLabel',['10S';'  0';'10N';'20N';'30N'],'fontname','Arial','fontsize',6);
195set (gca,'XTick',[-30:10:30],'XTickLabel',['30W';'20W';'10W';'  0';'10E';'20E';'30E'],'fontname','Arial','fontsize',6);
196set (gca,'tickDir','out');
197
198clear carte1 x y a b carte coco;
199carte1=C(:,423);
200carte=reshape(carte1,25,17);
201carte=carte';
202clear carte1;
203
204% defintion des lat et lon
205lon=[-30:2.5:30]';
206lat=[-10:2.5:30];
207
208subplot(3,2,5);
209palette;
210for a=1:17;
211    for b=1:25;
212        if carte(a,b)>0.2;
213            carte(a,b)=0.2;
214        elseif carte(a,b)<-0.2;
215            carte(a,b)=-0.2;
216        end;
217    end;
218end;
219carte(1,1)=-0.2001;
220carte(1,2)=0.2001;
221
222contourf(lon,lat,-carte,[-0.2:0.02:0.2],'LineStyle','none');
223gradsname=['carte_eof3_mode_sahel_',df];
224sauvegrads(gradsname,-carte,[-30 2.5 -10 2.5]);
225clear gradsname;
226colorbar;
227title('OLR EOF3','Fontsize',8);
228hold on;
229cartemonde;
230set (gca,'YTick',[-10:10:30],'YTickLabel',['10S';'  0';'10N';'20N';'30N'],'fontname','Arial','fontsize',6);
231set (gca,'XTick',[-30:10:30],'XTickLabel',['30W';'20W';'10W';'  0';'10E';'20E';'30E'],'fontname','Arial','fontsize',6);
232set (gca,'tickDir','out');
233
234clear carte1 x y a b carte coco;
235carte1=C(:,422);
236carte=reshape(carte1,25,17);
237carte=carte';
238clear carte1;
239
240% defintion des lat et lon
241lon=[-30:2.5:30]';
242lat=[-10:2.5:30];
243
244subplot(3,2,2);
245palette;
246for a=1:17;
247    for b=1:25;
248        if carte(a,b)>0.2;
249            carte(a,b)=0.2;
250        elseif carte(a,b)<-0.2;
251            carte(a,b)=-0.2;
252        end;
253    end;
254end;
255carte(1,1)=-0.2001;
256carte(1,2)=0.2001;
257
258contourf(lon,lat,-carte,[-0.2:0.02:0.2],'LineStyle','none');
259gradsname=['carte_eof4_mode_sahel_',df];
260sauvegrads(gradsname,-carte,[-30 2.5 -10 2.5]);
261clear gradsname;
262colorbar;
263title('OLR EOF4','Fontsize',8);
264hold on;
265cartemonde;
266set (gca,'YTick',[-10:10:30],'YTickLabel',['10S';'  0';'10N';'20N';'30N'],'fontname','Arial','fontsize',6);
267set (gca,'XTick',[-30:10:30],'XTickLabel',['30W';'20W';'10W';'  0';'10E';'20E';'30E'],'fontname','Arial','fontsize',6);
268set (gca,'tickDir','out');
269
270subplot(3,2,4);
271vaude=0;
272for a=1:425;
273   vaude=vaude+L(a,a);
274end;
275vecteurs=zeros(20,1);
276for a=1:20;
277   b=425-(a-1);
278   vecteurs(a)=100*(L(b,b)/vaude);
279end;
280x=[1:20]';
281
282bar(x,vecteurs,'LineStyle','none')
283fullfilename=[IRCAAM_OD,'vecteurs_eof_',df,'.txt'];
284save(fullfilename,'vecteurs','-ASCII');
285clear fullfilename;
286
287axis([0.5 20.5 0 25]);
288set (gca,'YTick',[0:5:25],'YTickLabel',[0:5:25],'fontname','Arial','fontsize',6);
289set (gca,'XTick',[2:2:20],'XTickLabel',[2:2:20],'fontname','Arial','fontsize',6);
290set (gca,'tickDir','out');
291
292fullfilename=[IRCAAM_OD,'resultats_eof_jjas_2006_',df,'.eps'];
293print('-depsc2',fullfilename);
294clear fullfilename;
Note: See TracBrowser for help on using the repository browser.