source: trunk/src/mode_sahelien/time_serie_jjas_df.m @ 88

Last change on this file since 88 was 88, checked in by pinsard, 13 years ago

Consolidation of shell scripts

File size: 4.3 KB
Line 
1function time_serie_jjas_df(period1, period2)
2% time_serie_jjas_df ++explication between period1 days and period2 days
3
4%+
5%
6%  .. _time_serie_jjas_df.m:
7%
8% ====================
9% time_serie_jjas_df.m
10% ====================
11%
12% ++
13%
14% DESCRIPTION
15% ===========
16%
17% From :file:`eof_{period1}-{period2}d_jjas.mat`,
18% ``time_serie_jjas_df`` compute ++.
19%
20% ``time_serie_jjas_df`` plot ++.
21%
22% ``time_serie_jjas_df`` save :file:`eof[123]{period1}-{period2}d.txt`.
23%
24% 2 Postscript files
25% :file:`time_serie_jjas_{period1}-{period2}d_part[12].eps` are
26% written.
27%
28% EXAMPLES
29% ========
30%
31% Following line read :file:`eof_10-30d_jjas.mat`,
32% compute ++,
33% plot ++,
34% write :file:`eof[123]_10-30d.txt` and
35% write :file:`time_serie_jjas_eof1_10-30d_part[12].eps`::
36%
37% >> time_serie_jjas_df(10,30);
38%
39% SEE ALSO
40% ========
41%
42% :ref:`composite_olr_eof_df.m`
43%
44% TODO
45% ====
46%
47% improve description
48%
49% improve file pb
50%
51% use return function
52%
53% nb of figure depends on number of years to be plot : so figure(3) contains
54% something only if nb years > 23 (or so), so Postscript file of figure(3)
55% shoul not be saved if  nb years is less than 23 !
56%
57% EVOLUTIONS
58% ==========
59%
60% $Id$
61%
62% - fplod 2009-02-11T16:27:34Z aedon.locean-ipsl.upmc.fr (Darwin)
63%
64%   * add try/catch on opening file for reading
65%
66% - fplod 2009-02-10T14:28:00Z aedon.locean-ipsl.upmc.fr (Darwin)
67%
68%   * replace ndmin by period1 and ndmax by period2
69%
70% - fplod 2009-01-28T15:28:54Z aedon.locean-ipsl.upmc.fr (Darwin)
71%
72%   * created from time_serie_jjas_30100.m to replace it as well as
73%     time_serie_jjas.m, time_serie_jjas_25_90.m and time_serie_jjas_10_25.m
74%
75%     Days will be now written ``period1``\-``period2d`` (ex: 10-30d) in filenames.
76%
77%-
78
79global IRCAAM_ID;
80global IRCAAM_OD;
81
82if nargin==2
83 % period1 must be lower than period2
84 if (period1 > period2)
85  disp(['period1 = ', int2str(period1)]);
86  disp(['period2 = ', int2str(period2)]);
87  error('eee : period1 must be lower than period2');
88 end
89else
90  usage='usage : time_serie_jjas_df(period1, period2)';
91  disp(usage);
92  error('eee : wrong arguments numbers')
93end
94
95% period1 and period2 will be used in xx-yyd form in filenames
96df = [int2str(period1),'-',int2str(period2),'d'];
97clear period1;
98clear period2;
99
100fullfilename=[IRCAAM_ID,'eof_', df, '_jjas.mat'];
101try
102 status=load(fullfilename);
103catch
104 error('eee : File %s not found\n', fullfilename);
105end
106
107clear fullfilename;
108
109C=status.C;
110olr=status.olr;
111clear status;
112
113olr=olr';
114PC1=olr*C;
115
116%%%%%%% cronique de la VP1
117time_serie_olr1=PC1(:,425);
118time_serie_olr2=PC1(:,424);
119time_serie_olr3=PC1(:,423);
120
121dt_olr1=std(time_serie_olr1);
122dt_olr2=std(time_serie_olr2);
123dt_olr3=std(time_serie_olr3);
124
125for a=1:3416;
126   time_serie_olr1(a)=time_serie_olr1(a)/dt_olr1;
127   time_serie_olr2(a)=time_serie_olr2(a)/dt_olr2;
128   time_serie_olr3(a)=time_serie_olr3(a)/dt_olr3;
129end;
130
131fullfilename=[IRCAAM_ID,'eof1_',df,'.txt'];
132save(fullfilename,'time_serie_olr1','-ASCII');
133clear fullfilename;
134
135fullfilename=[IRCAAM_ID,'eof2_',df,'.txt'];
136save(fullfilename,'time_serie_olr2','-ASCII');
137clear fullfilename;
138
139fullfilename=[IRCAAM_ID,'eof3_',df,'.txt'];
140save(fullfilename,'time_serie_olr3','-ASCII');
141clear fullfilename;
142
143x=[1:3416]';
144for a=1:22;
145   if a<12;
146      figure(1);
147      subplot(4,3,a);
148   elseif a<23;
149      figure(2);
150      subplot(4,3,a-11);
151   else
152      figure(3);
153      subplot(4,3,a-22);
154   end;
155   clear koro1;
156   debut=(a-1)*122+1;
157   fin=a*122;
158   koro1=time_serie_olr1(debut:fin);
159
160   clear x;
161   x=[1:122]';
162   plot(x,koro1,'r');
163   hold on
164   y=zeros(122,1);
165   plot(x,y,'k:');
166   title(a+1978,'FontSize',8);
167   my_title=['serie temporelle VP1 filtrage ', df];
168   if a==2;
169       text(0,5.5,my_title);
170   elseif a==13;
171       text(0,5.5,my_title);
172   elseif a==24;
173       text(0,5.5,my_title);
174   end;
175   set (gca,'tickDir','out');
176   axis([1 122 -3 3]);
177
178   set (gca,'YTick',[-3:1:3],'YTickLabel',[-3:1:3],'fontname','Arial','fontsize',6);
179   set (gca,'XTick',[0:20:120],'XTickLabel',[0:20:120],'fontname','Arial','fontsize',6);
180end;
181
182figure(1);
183fullfilename=[IRCAAM_OD,'time_serie_jjas_', df, '_part1.eps'];
184print('-depsc2',fullfilename);
185clear fullfilename;
186figure(2);
187fullfilename=[IRCAAM_OD,'time_serie_jjas_', df, '_part2.eps'];
188print('-depsc2',fullfilename);
189clear fullfilename;
190figure(3);
191fullfilename=[IRCAAM_OD,'time_serie_jjas_', df, '_part3.eps'];
192print('-depsc2',fullfilename);
193clear fullfilename;
Note: See TracBrowser for help on using the repository browser.