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

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

better representation of variable parts in filenames

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