source: trunk/src/SIMULS_IRCAAM/time_serie_eof_df.m

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

better representation of variable parts in filenames

File size: 5.3 KB
Line 
1function time_serie_eof_df(ircaam_dataset,simulation,period1, period2)
2% time_serie_eof_df ++explication between period1 days and period2 days
3
4%+
5%
6%  .. _time_serie_eof_df.m:
7%
8% ===================
9% time_serie_eof_df.m
10% ===================
11%
12% ++
13%
14% DESCRIPTION
15% ===========
16%
17% From :file:`eof_arpege_{simulation}_{period1}-{period2}d.mat`,
18% ``time_serie_eof_df`` compute ++.
19%
20% ``time_serie_eof_df`` plot ++.
21%
22% ``time_serie_eof_df`` save :file:`eof[12]_arpege_{simulation}_{period1}-{period2}d.txt`.
23%
24% 2 Postscript files
25% :file:`time_serie_arpege_{simulation}_{period1}-{period2}d_part[12].eps` are
26% written.
27%
28% EXAMPLES
29% ========
30%
31% Following line read :file:`eof_arpege_TrNQIVIV_10-30d.mat`,
32% compute ++,
33% plot ++,
34% write :file:`eof[12]_arpege_TrNQIVIV_10-30d.txt` and
35% write :file:`time_serie_arpege_TrNQIVIV_10-30d_part[12].eps`::
36%
37% >> time_serie_eof_df('arpege','TrNQIVIV',10,30)
38%
39% SEE ALSO
40% ========
41%
42% :ref:`eof_df.m`
43%
44% :ref:`carte_eof_df.m`
45%
46% TODO
47% ====
48%
49% improve description
50%
51% improve file pb
52%
53% use return function
54%
55% EVOLUTIONS
56% ==========
57%
58% $Id$
59%
60% - fplod 2009-02-11T16:27:34Z aedon.locean-ipsl.upmc.fr (Darwin)
61%
62%   * add try/catch on opening file for reading
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-02T10:01:21Z aedon.locean-ipsl.upmc.fr (Darwin)
69%
70%   * created from time_serie_afr_1030.m to replace it as well as
71%     time_serie_afr_30100.m, time_serie_as_1030.m, time_serie_as_30100.m,
72%     time_serie_ctl_1030.m, time_serie_ctl_30100.m, time_serie_tr_1030.m and
73%     time_serie_tr_30100.m
74%
75%     Days will be now written ``period1``\-``period2d`` (ex: 10-30d) in filenames.
76%
77%     Dataset ``arpege`` will be forced in output file names.
78%
79%     Simulation name will be add to  output file names (see parameters).
80%
81%     Postscript files names will be suffixe by partx instead of letter.
82%
83%-
84
85global IRCAAM_ID;
86global IRCAAM_OD;
87
88if nargin==4
89 % ircaam_dataset must be equal to arpege
90 if ~strcmp(ircaam_dataset,'arpege')
91  disp(['ircaam_dataset = ', ircaam_dataset]);
92  error('eee : ircaam_dataset must be equal to arpege');
93 end
94 if strcmp(ircaam_dataset,'arpege')
95  list_simulation={'AfNQIVIV','TrNQIVIV','AsNQIVIV','CtIV','CtCl'};
96 end
97 switch simulation
98 case list_simulation
99  % ok
100 otherwise
101  disp(['simulation = ', simulation]);
102  disp(['list_simulation = ', mat2str(list_simulation)]);
103  error('eee : simulation must be equal to one of list_simulation');
104 end
105 clear list_simulation;
106 % period1 must be lower than period2
107 if (period1 > period2)
108  disp(['period1 = ', int2str(period1)]);
109  disp(['period2 = ', int2str(period2)]);
110  error('eee : period1 must be lower than period2');
111 end
112else
113  usage='usage : time_serie_jjas_df(ircaam_dataset,simulation,period1, period2)';
114  disp(usage);
115  error('eee : wrong arguments numbers')
116end
117
118% period1 and period2 will be used in xx-yyd form in filenames
119df = [int2str(period1),'-',int2str(period2),'d'];
120clear period1;
121clear period2;
122
123close all;
124
125fullfilename=[IRCAAM_ID,'eof_',ircaam_dataset,'_', simulation, '_', df, '.mat'];
126try
127 status=load(fullfilename,'C','olr');
128catch
129 error('eee : File %s not found\n', fullfilename);
130end
131
132clear fullfilename;
133
134C=status.C;
135olr=status.olr;
136clear status;
137
138olr=olr';
139PC1=olr*C;
140
141%%%%%%% cronique de la VP1
142time_serie_olr1=PC1(:,360);
143time_serie_olr2=PC1(:,359);
144
145dt_olr1=std(time_serie_olr1);
146dt_olr2=std(time_serie_olr2);
147
148for a=1:3538;
149   time_serie_olr1(a)=time_serie_olr1(a)/dt_olr1;
150   time_serie_olr2(a)=time_serie_olr2(a)/dt_olr2;
151end;
152
153fullfilename=[IRCAAM_OD,'eof1_',ircaam_dataset,'_', simulation, '_', df,'.txt'];
154save(fullfilename,'time_serie_olr1','-ASCII');
155clear fullfilename;
156
157fullfilename=[IRCAAM_OD,'eof2_',ircaam_dataset,'_', simulation, '_', df,'.txt'];
158save(fullfilename','time_serie_olr2','-ASCII');
159clear fullfilename;
160
161x=[1:3538]';
162for a=1:29;
163   if a<12;
164      figure(1);
165      subplot(4,3,a);
166   elseif a<23;
167      figure(2);
168      subplot(4,3,a-11);
169   else
170      figure(3);
171      subplot(4,3,a-22);
172   end;
173   clear koro1;
174   debut=(a-1)*122+1;
175   fin=a*122;
176   koro1=time_serie_olr1(debut:fin);
177   koro2=time_serie_olr2(debut:fin);
178   clear x;
179   x=[1:122]';
180   plot(x,koro1,'r');
181   hold on
182   plot(x,koro2,'k');
183   y=zeros(122,1);
184   plot(x,y,'k:');
185   title(a+1970,'FontSize',8);
186   my_title=['serie temporelle eof ', ircaam_dataset, ' ' , simulation, ' ' , df];
187   if a==2;
188       text(0,5.5,my_title);
189   elseif a==13;
190       text(0,5.5,my_title);
191   elseif a==24;
192       text(0,5.5,my_title);
193   end;
194   clear my_title;
195   set (gca,'tickDir','out');
196   axis([1 122 -3 3]);
197
198   set (gca,'YTick',[-3:1:3],'YTickLabel',[-3:1:3],'fontname','Arial','fontsize',6);
199   set (gca,'XTick',[0:20:120],'XTickLabel',[0:20:120],'fontname','Arial','fontsize',6);
200end;
201
202figure(1);
203fullfilename=[IRCAAM_OD,'time_serie_eof_', ircaam_dataset, '_', simulation, '_', df, '_part1.eps'];
204print('-depsc2',fullfilename);
205clear fullfilename;
206
207figure(2);
208fullfilename=[IRCAAM_OD,'time_serie_eof_', ircaam_dataset, '_', simulation, '_', df, '_part2.eps'];
209print('-depsc2',fullfilename);
210clear fullfilename;
211
212figure(3);
213fullfilename=[IRCAAM_OD,'time_serie_eof_', ircaam_dataset, '_', simulation, '_', df, '_part3.eps'];
214print('-depsc2',fullfilename);
215clear fullfilename;
216
217clear ircaam_dataset;
218clear simulation;
219clear df;
Note: See TracBrowser for help on using the repository browser.