source: trunk/src/mode_sahelien/time_serie_ER_rossby_df.m @ 59

Last change on this file since 59 was 59, checked in by pinsard, 15 years ago

add some try/catch on opening file for reading

File size: 3.5 KB
Line 
1function time_serie_ER_rossby_df(period1, period2)
2% time_serie_ER_rossby_df ++explication between period1 days and period2 days
3
4%+
5% module
6% ======
7%
8% ++
9%
10% DESCRIPTION
11% ===========
12%
13% plot ++ from file eof_rossby_jjas_2006_10-30d.mat
14%
15% EXAMPLES
16% ========
17%
18% Following line read eof_rossby_jjas_2006_10-30d.mat, plot ++and produce  table_ER_10-30d.txt file
19% ::
20%
21% >> time_serie_ER_rossby_df(10,30);
22%
23% SEE ALSO
24% ========
25%
26% olr_eof_jjas2006_rossby_df.m_
27%
28% .. _olr_eof_jjas2006_rossby_df.m : olr_eof_jjas2006_rossby_df.m.html
29%
30% carte_eofER_1030_article.m_
31%
32% .. _carte_eofER_1030_article.m : carte_eofER_1030_article.m.html
33%
34% carte_eof_ER_jjas_df.m_
35%
36% .. _carte_eof_ER_jjas_df.m : carte_eof_ER_jjas_df.m.html
37%
38% time_serie_ER_rossby_df_complet.m_
39%
40% .. _time_serie_ER_rossby_df_complet.m : time_serie_ER_rossby_df_complet.m.html
41%
42% reconstitution_ER_rossby_df.m_
43%
44% .. _reconstitution_ER_rossby_df.m : reconstitution_ER_rossby_df.m.html
45%
46% TODO
47% ====
48%
49% improve description
50%
51% improve file pb
52%
53% use return function
54%
55% find where ``table_ER_??-??d.txt`` are used
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-27T10:07:29Z aedon.locean-ipsl.upmc.fr (Darwin)
71%
72%   * created from time_serie_ER_rossby_1030.m to replace it as well as
73%     time_serie_ER_rossby_30100.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_ER_rossby_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_rossby_jjas_2006_',df,'.mat'];
101try
102 status=load(fullfilename,'C','olr');
103catch
104 error('eee : File %s not found\n', fullfilename);
105end
106
107clear fullfilename;
108C=status.C;
109olr=status.olr;
110clear status;
111
112olr=olr';
113PC1=olr*C;
114
115time_serie_olr1=PC1(:,425);
116time_serie_olr2=PC1(:,424);
117year=zeros(122,28);
118for a=1:122
119    for b=1:28;
120       year(a,b)=1979+(b-1);
121    end;
122end;
123year=reshape(year,3416,1);
124
125day=zeros(122,28);
126for a=1:122
127    for b=1:28;
128       day(a,b)=31+28+31+30+31+a;
129    end;
130end;
131day=reshape(day,3416,1);
132
133table_ER=zeros(3416,4);
134for a=1:3416;
135     for b=1:4;
136        table_ER(a,1)=year(a);
137        table_ER(a,2)=day(a);
138        table_ER(a,3)=time_serie_olr1(a);
139        table_ER(a,4)=time_serie_olr2(a);
140     end;
141end;
142
143fullfilename=[IRCAAM_OD,'table_ER_',df,'.txt'];
144save(fullfilename,'table_ER','-ASCII');
145clear fullfilename;
146
147a=1;
148clear koro1
149debut=(a-1)*122+1;
150fin=a*122;
151koro1=time_serie_olr1(debut:fin);
152koro2=time_serie_olr2(debut:fin);
153x=[1:122]';
154aa=plot(x,-koro1,'r');
155hold on;
156bb=plot(x,-koro2,'k');
157cc=legend('EOF1','EOF2');
158set (cc,'fontsize',6);
159legend boxoff
160y=zeros(122,1);
161plot(x,y,'k:');
162
163set (gca,'tickDir','out');
164axis([1 122 -100 100]);
165
166set (gca,'YTick',[-100:20:100],'YTickLabel',[-100:20:100],'fontname','Arial','fontsize',6);
167set (gca,'XTick',[0:20:120],'XTickLabel',[0:20:120],'fontname','Arial','fontsize',6);
Note: See TracBrowser for help on using the repository browser.