source: trunk/src/SIMULS_IRCAAM/carte_eof_df.m @ 85

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

better representation of variable parts in filenames

File size: 6.7 KB
Line 
1function carte_eof_df(ircaam_dataset,simulation,period1, period2)
2% carte_eof_df ++explication between period1 days and period2 days
3
4%+
5%
6%  .. _carte_eof_df.m:
7%
8% ==============
9% carte_eof_df.m
10% ==============
11%
12% ++
13%
14% DESCRIPTION
15% ===========
16%
17% From :file:`eof_arpege_{simulation}_{period1}-{period2}d.mat`
18% and :file:`rlut_d.{simulation}.197106-09.nc`,
19% ``carte_eof_df`` compute ++.
20%
21% ``carte_eof_df`` plot ++.
22%
23% 1 Postscript file
24% :file:`carte_arpege_{simulation}_{period1}-{period2}d.eps` is
25% written.
26%
27% CAUTIONS
28% ========
29%
30% can't work with octave because of ncload.
31%
32% EXAMPLES
33% ========
34%
35% Following line read :file:`eof_arpege_AfNQIVIV_10-30d.mat` and
36% :file:`rlut_d.AfNQIVIV.197106-09.nc`,
37% compute ++,
38% plot ++,
39% write :file:`carte_arpege_AfNQIVIV_10-30d.eps`::
40%
41% >> carte_eof_df('arpege','AfNQIVIV',10,30)
42%
43% SEE ALSO
44% ========
45%
46% :ref:`eof_df.m`
47%
48% :ref:`time_serie_eof_df.m`
49%
50% TODO
51% ====
52%
53% improve description
54%
55% improve file pb
56%
57% use return function
58%
59% EVOLUTIONS
60% ==========
61%
62% $Id$
63%
64% - fplod 2009-02-10T14:28:00Z aedon.locean-ipsl.upmc.fr (Darwin)
65%
66%   * replace ndmin by period1 and ndmax by period2
67%
68% - fplod 2009-02-02T13:45:57Z aedon.locean-ipsl.upmc.fr (Darwin)
69%
70%   * created from carte_eof_ircaam_1030.m to replace it as well as
71%     carte_eof_ircaam_1030_as.m, carte_eof_ircaam_1030_ctl.m,
72%     carte_eof_ircaam_1030_ctl_clim.m, carte_eof_ircaam_1030_tr.m,
73%     carte_eof_ircaam_30100.m, carte_eof_ircaam_30100_as.m,
74%     carte_eof_ircaam_30100_ctl.m and carte_eof_ircaam_30100_tr.m
75%
76%     Days will be now written ``period1``\-``period2d`` (ex: 10-30d) in filenames.
77%
78%     Dataset ``arpege`` will be forced in output file names.
79%
80%     Simulation name will be add to output file names (see parameters).
81%
82%-
83
84global IRCAAM_ID;
85global IRCAAM_OD;
86
87if nargin==4
88 % ircaam_dataset must be equal to arpege
89 if ~strcmp(ircaam_dataset,'arpege')
90  disp(['ircaam_dataset = ', ircaam_dataset]);
91  error('eee : ircaam_dataset must be equal to arpege');
92 end
93 if strcmp(ircaam_dataset,'arpege')
94  list_simulation={'AfNQIVIV','TrNQIVIV','AsNQIVIV','CtIV','CtCl'};
95 end
96 switch simulation
97 case list_simulation
98  % ok
99 otherwise
100  disp(['simulation = ', simulation]);
101  disp(['list_simulation = ', mat2str(list_simulation)]);
102  error('eee : simulation must be equal to one of list_simulation');
103 end
104 clear list_simulation;
105 % period1 must be lower than period2
106 if (period1 > period2)
107  disp(['period1 = ', int2str(period1)]);
108  disp(['period2 = ', int2str(period2)]);
109  error('eee : period1 must be lower than period2');
110 end
111else
112  usage='usage : carte_eof_df(ircaam_dataset,simulation,period1, period2)';
113  disp(usage);
114  error('eee : wrong arguments numbers')
115end
116
117% period1 and period2 will be used in xx-yyd form in filenames
118df = [int2str(period1),'-',int2str(period2),'d'];
119clear period1;
120clear period2;
121
122close all;
123
124fullfilename=[IRCAAM_ID,'eof_',ircaam_dataset,'_', simulation, '_', df, '.mat'];
125try
126 status=load(fullfilename,'C','L');
127catch
128 error('eee : File %s not found\n', fullfilename);
129end
130
131clear fullfilename;
132
133C=status.C;
134L=status.L;
135clear status;
136
137carte1=C(:,360);
138carte=reshape(carte1,24,15);
139carte=carte';
140clear carte1;
141
142% definition des lat et lon
143fullfilename=[IRCAAM_ID,'rlut_d.',simulation, '.197106-09.nc'];
144ncload(fullfilename,'lat','lon');
145clear fullfilename;
146
147lon=lon-180;
148lon=lon(54:77);
149lat=lat(29:43)';
150
151figure(1);
152orient('landscape');
153subplot(3,2,1);
154palette;
155for a=1:15;
156    for b=1:24;
157        if carte(a,b)>0.2;
158            carte(a,b)=0.2;
159        elseif carte(a,b)<-0.2;
160            carte(a,b)=-0.2;
161        end;
162    end;
163end;
164carte(1,1)=-0.2001;
165carte(1,2)=0.2001;
166
167contourf(lon,lat,-carte,[-0.2:0.02:0.2],'LineStyle','none');
168colorbar;
169title('OLR EOF1','Fontsize',8);
170hold on;
171cartemonde;
172set (gca,'YTick',[-10:10:30],'YTickLabel',['10S';'  0';'10N';'20N';'30N'],'fontname','Arial','fontsize',6);
173set (gca,'XTick',[-30:10:30],'XTickLabel',['30W';'20W';'10W';'  0';'10E';'20E';'30E'],'fontname','Arial','fontsize',6);
174set (gca,'tickDir','out');
175
176clear carte1 x y a b carte coco;
177carte1=C(:,359);
178carte=reshape(carte1,24,15);
179carte=carte';
180
181clear carte1;
182
183subplot(3,2,3);
184palette;
185for a=1:15;
186    for b=1:24;
187        if carte(a,b)>0.2;
188            carte(a,b)=0.2;
189        elseif carte(a,b)<-0.2;
190            carte(a,b)=-0.2;
191        end;
192    end;
193end;
194carte(1,1)=-0.2001;
195carte(1,2)=0.2001;
196
197contourf(lon,lat,carte,[-0.2:0.02:0.2],'LineStyle','none');
198colorbar;
199
200title('OLR EOF2','Fontsize',8);
201hold on;
202cartemonde;
203set (gca,'YTick',[-10:10:30],'YTickLabel',['10S';'  0';'10N';'20N';'30N'],'fontname','Arial','fontsize',6);
204set (gca,'XTick',[-30:10:30],'XTickLabel',['30W';'20W';'10W';'  0';'10E';'20E';'30E'],'fontname','Arial','fontsize',6);
205set (gca,'tickDir','out');
206
207clear carte1 x y a b carte coco;
208carte1=C(:,358);
209carte=reshape(carte1,24,15);
210carte=carte';
211clear carte1;
212
213subplot(3,2,5);
214palette;
215for a=1:15;
216    for b=1:24;
217        if carte(a,b)>0.2;
218            carte(a,b)=0.2;
219        elseif carte(a,b)<-0.2;
220            carte(a,b)=-0.2;
221        end;
222    end;
223end;
224carte(1,1)=-0.2001;
225carte(1,2)=0.2001;
226
227contourf(lon,lat,-carte,[-0.2:0.02:0.2],'LineStyle','none');
228colorbar;
229title('OLR EOF3','Fontsize',8);
230hold on;
231cartemonde;
232set (gca,'YTick',[-10:10:30],'YTickLabel',['10S';'  0';'10N';'20N';'30N'],'fontname','Arial','fontsize',6);
233set (gca,'XTick',[-30:10:30],'XTickLabel',['30W';'20W';'10W';'  0';'10E';'20E';'30E'],'fontname','Arial','fontsize',6);
234set (gca,'tickDir','out');
235
236clear carte1 x y a b carte coco;
237carte1=C(:,357);
238carte=reshape(carte1,24,15);
239carte=carte';
240clear carte1;
241
242subplot(3,2,2);
243palette;
244for a=1:15;
245    for b=1:24;
246        if carte(a,b)>0.2;
247            carte(a,b)=0.2;
248        elseif carte(a,b)<-0.2;
249            carte(a,b)=-0.2;
250        end;
251    end;
252end;
253carte(1,1)=-0.2001;
254carte(1,2)=0.2001;
255
256contourf(lon,lat,-carte,[-0.2:0.02:0.2],'LineStyle','none');
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:360;
268   vaude=vaude+L(a,a);
269end;
270vecteurs=zeros(20,1);
271for a=1:20;
272   b=360-(a-1);
273   vecteurs(a)=100*(L(b,b)/vaude);
274end;
275x=[1:20]';
276
277bar(x,vecteurs,'LineStyle','none')
278axis([0.5 20.5 0 25]);
279set (gca,'YTick',[0:5:25],'YTickLabel',[0:5:25],'fontname','Arial','fontsize',6);
280set (gca,'XTick',[2:2:20],'XTickLabel',[2:2:20],'fontname','Arial','fontsize',6);
281set (gca,'tickDir','out');
282
283fullfilename=[IRCAAM_OD,'carte_eof_', ircaam_dataset, '_', simulation, '_', df, '.eps'];
284print('-depsc2',fullfilename);
285clear fullfilename;
286
287clear ircaam_dataset;
288clear simulation;
289clear df;
Note: See TracBrowser for help on using the repository browser.