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
RevLine 
[56]1function time_serie_eof_df(ircaam_dataset,simulation,period1, period2)
2% time_serie_eof_df ++explication between period1 days and period2 days
[46]3
4%+
[17]5%
[82]6%  .. _time_serie_eof_df.m:
7%
[75]8% ===================
9% time_serie_eof_df.m
10% ===================
11%
[46]12% ++
13%
14% DESCRIPTION
15% ===========
16%
[85]17% From :file:`eof_arpege_{simulation}_{period1}-{period2}d.mat`,
[46]18% ``time_serie_eof_df`` compute ++.
19%
20% ``time_serie_eof_df`` plot ++.
21%
[85]22% ``time_serie_eof_df`` save :file:`eof[12]_arpege_{simulation}_{period1}-{period2}d.txt`.
[46]23%
24% 2 Postscript files
[85]25% :file:`time_serie_arpege_{simulation}_{period1}-{period2}d_part[12].eps` are
[46]26% written.
27%
28% EXAMPLES
29% ========
30%
[85]31% Following line read :file:`eof_arpege_TrNQIVIV_10-30d.mat`,
[46]32% compute ++,
33% plot ++,
[85]34% write :file:`eof[12]_arpege_TrNQIVIV_10-30d.txt` and
35% write :file:`time_serie_arpege_TrNQIVIV_10-30d_part[12].eps`::
[46]36%
37% >> time_serie_eof_df('arpege','TrNQIVIV',10,30)
38%
39% SEE ALSO
40% ========
41%
[82]42% :ref:`eof_df.m`
[46]43%
[82]44% :ref:`carte_eof_df.m`
[46]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%
[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%
[56]64% - fplod 2009-02-10T14:28:00Z aedon.locean-ipsl.upmc.fr (Darwin)
65%
66%   * replace ndmin by period1 and ndmax by period2
67%
[46]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%
[56]75%     Days will be now written ``period1``\-``period2d`` (ex: 10-30d) in filenames.
[46]76%
[48]77%     Dataset ``arpege`` will be forced in output file names.
[46]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%-
[17]84
[46]85global IRCAAM_ID;
86global IRCAAM_OD;
87
88if nargin==4
[52]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');
[46]93 end
[52]94 if strcmp(ircaam_dataset,'arpege')
[46]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;
[56]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');
[46]111 end
112else
[56]113  usage='usage : time_serie_jjas_df(ircaam_dataset,simulation,period1, period2)';
[46]114  disp(usage);
115  error('eee : wrong arguments numbers')
116end
117
[56]118% period1 and period2 will be used in xx-yyd form in filenames
119df = [int2str(period1),'-',int2str(period2),'d'];
120clear period1;
121clear period2;
[46]122
[17]123close all;
124
[52]125fullfilename=[IRCAAM_ID,'eof_',ircaam_dataset,'_', simulation, '_', df, '.mat'];
[59]126try
127 status=load(fullfilename,'C','olr');
128catch
129 error('eee : File %s not found\n', fullfilename);
130end
131
[46]132clear fullfilename;
133
[24]134C=status.C;
135olr=status.olr;
136clear status;
137
[17]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;
[25]151end;
[17]152
[52]153fullfilename=[IRCAAM_OD,'eof1_',ircaam_dataset,'_', simulation, '_', df,'.txt'];
[46]154save(fullfilename,'time_serie_olr1','-ASCII');
155clear fullfilename;
[17]156
[52]157fullfilename=[IRCAAM_OD,'eof2_',ircaam_dataset,'_', simulation, '_', df,'.txt'];
[46]158save(fullfilename','time_serie_olr2','-ASCII');
159clear fullfilename;
160
[17]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);
[25]172   end;
[21]173   clear koro1;
[17]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);
[52]186   my_title=['serie temporelle eof ', ircaam_dataset, ' ' , simulation, ' ' , df];
[17]187   if a==2;
[46]188       text(0,5.5,my_title);
[25]189   elseif a==13;
[46]190       text(0,5.5,my_title);
[17]191   elseif a==24;
[46]192       text(0,5.5,my_title);
[17]193   end;
[46]194   clear my_title;
[17]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);
[46]199   set (gca,'XTick',[0:20:120],'XTickLabel',[0:20:120],'fontname','Arial','fontsize',6);
[17]200end;
201
202figure(1);
[52]203fullfilename=[IRCAAM_OD,'time_serie_eof_', ircaam_dataset, '_', simulation, '_', df, '_part1.eps'];
[46]204print('-depsc2',fullfilename);
205clear fullfilename;
206
[17]207figure(2);
[52]208fullfilename=[IRCAAM_OD,'time_serie_eof_', ircaam_dataset, '_', simulation, '_', df, '_part2.eps'];
[46]209print('-depsc2',fullfilename);
210clear fullfilename;
211
[17]212figure(3);
[52]213fullfilename=[IRCAAM_OD,'time_serie_eof_', ircaam_dataset, '_', simulation, '_', df, '_part3.eps'];
[46]214print('-depsc2',fullfilename);
215clear fullfilename;
216
[52]217clear ircaam_dataset;
[46]218clear simulation;
219clear df;
Note: See TracBrowser for help on using the repository browser.