source: trunk/src/mode_sahelien/reconstitution_ER_rossby_df.m @ 91

Last change on this file since 91 was 91, checked in by pinsard, 10 years ago

fix thanks to coding rules

File size: 5.0 KB
Line 
1function reconstitution_ER_rossby_df(period1, period2)
2% reconstitution_ER_rossby_df ++explication between period1 days and period2 days
3
4%+
5%
6%  .. _reconstitution_ER_rossby_df.m:
7%
8% =============================
9% reconstitution_ER_rossby_df.m
10% =============================
11%
12% ++
13%
14% DESCRIPTION
15% ===========
16%
17% plot ++ from file :file:`eof_rossby_jjas_2006_10-30d.mat`,
18% produce a ASCII file :file:`eof12_rossby_10-30d.txt`,
19% produce 3 Postscript files :file:`reconstitution1_eof12_filtreER_10-30d.eps`.
20%
21% EXAMPLES
22% ========
23%
24% Following line read :file:`eof_rossby_jjas_2006_10-30d.mat`, produce an ASCII file
25% :file:`eof12_rossby_10-30d.txt`, produce 3 Postscript files
26% :file:`reconstitution1_eof12_filtreER_10-30d.eps`::
27%
28% >> reconstitution_ER_rossby_df(10,30);
29%
30% SEE ALSO
31% ========
32%
33% :ref:`carte_eof_ER_jjas_df.m`
34%
35% :ref:`carte_eof_ER_1030_article.m`
36%
37% :ref:`time_serie_ER_rossby_df.m`
38%
39% TODO
40% ====
41%
42% improve description
43%
44% improve file pb
45%
46% use return function
47%
48% clean variables and plot
49%
50% EVOLUTIONS
51% ==========
52%
53% $Id$
54%
55% - fplod 2009-02-11T16:27:34Z aedon.locean-ipsl.upmc.fr (Darwin)
56%
57%   * add try/catch on opening file for reading
58%
59% - fplod 2009-02-10T14:28:00Z aedon.locean-ipsl.upmc.fr (Darwin)
60%
61%   * replace ndmin by period1 and ndmax by period2
62%
63% - fplod 2009-01-28T07:50:45Z aedon.locean-ipsl.upmc.fr (Darwin)
64%
65%   * created from reconstitution_ER_rossby_1030.m to replace it as well as
66%     reconstitution_ER_rossby_30100.m
67%
68%     Days will be now written ``period1``\-``period2d`` (ex: 10-30d) in filenames.
69%
70%-
71
72global IRCAAM_ID;
73global IRCAAM_OD;
74
75if nargin==2
76 % period1 must be lower than period2
77 if (period1 > period2)
78  disp(['period1 = ', int2str(period1)]);
79  disp(['period2 = ', int2str(period2)]);
80  error('eee : period1 must be lower than period2');
81 end
82else
83  usage='usage : reconstitution_ER_rossby_df(period1, period2)';
84  disp(usage);
85  error('eee : wrong arguments numbers')
86end
87% period1 and period2 will be used in xx-yyd form in filenames
88df = [int2str(period1),'-',int2str(period2),'d'];
89clear period1;
90clear period2;
91
92close all;
93
94%lon=[-30:2.5:30], lat=[-10:2.5:30]
95
96fullfilename=[IRCAAM_ID,'eof_rossby_jjas_2006_',df,'.mat'];
97try
98 status=load(fullfilename,'C','olr');
99catch
100 error('eee : File %s not found\n', fullfilename);
101end
102
103clear fullfilename;
104
105C=status.C;
106olr=status.olr;
107clear status;
108
109olr=olr';
110PC1=olr*C;
111
112cosa=zeros(3,3416,425);
113% boucle sur les VP
114for a=1:3;
115      for b=1:3416 % boucle sur le temps
116          for c=1:425 % boucle sur l espace
117             cosa(a,b,c)=PC1(b,426-a)*C(c,426-a);
118          end;
119      end;
120end;
121
122cosa1(:,:)=cosa(1,:,:);
123cosa1=reshape(cosa1,3416,25,17);
124
125cosa2(:,:)=cosa(2,:,:);
126cosa2=reshape(cosa2,3416,25,17);
127
128cosabis=cosa(1:2,:,:);
129cosa12(:,:)=sum(cosabis);
130clear cosabis;
131cosa12=reshape(cosa12,3416,25,17);
132
133figure(1);
134orient('landscape')
135figure(2);
136orient('landscape')
137figure(3);
138orient('landscape')
139
140% On sélectionne le domaine géographique
141
142% la latitude : 7.5N (8) 12.5N (10)
143% la longitude : 10W (9) 10E(17)
144lat1=8;
145lat2=10;
146lon1=9;
147lon2=17;
148taille=(lat2-lat1+1)*(lon2-lon1+1);
149
150cosa12=cosa12(:,lon1:lon2,lat1:lat2);
151clear cosi2;
152cosa12=reshape(cosa12,3416,taille);
153cosa12=cosa12';
154cosa12=mean(cosa12);
155cosa12=cosa12';
156
157fullfilename=[IRCAAM_ID,'eof12_rossby_',df,'.txt'];
158save(fullfilename,'cosa12','-ASCII');
159clear fullfilename;
160
161cosa12=reshape(cosa12,122,28);
162
163% On sélectionne le domaine géographique
164olr=reshape(olr,3416,25,17);
165cosa4=olr(:,lon1:lon2,lat1:lat2);
166clear olr;
167cosa4=reshape(cosa4,3416,taille);
168clear taille;
169cosa4=cosa4';
170cosa4=mean(cosa4);
171cosa4=cosa4';
172cosa4=reshape(cosa4,122,28);
173
174for a=1:28;
175     if a<12;
176        figure(1);
177        subplot(4,3,a);
178     elseif a<24
179        figure(2);
180        subplot(4,3,a-11);
181     else
182        figure(3);
183        subplot(4,3,a-23);
184     end;
185     y2=cosa12(:,a);
186     y4=cosa4(:,a);
187     x=[1:122]';
188     plot(x,y2);
189     hold on;
190     plot(x,y4,'k');
191     y5=zeros(122,1);
192     plot(x,y5,'k:');
193
194     title(a+1978,'Fontsize',8);
195     if a==2;
196         text(0,65,'OLR 5 -17.5N et 10W - 10E');
197     elseif a==13;
198         text(0,65,'OLR 5 - 17.5N et 10W - 10E');
199     end;
200     set (gca,'tickDir','out');
201     if a==11;
202        aa=legend('OLR VP1-2','OLR NOAA');
203        set (aa,'fontsize',8,'Position',[0.6800 0.1039 0.1270 0.1642])
204        legend boxoff;
205     elseif a==22;
206        clear aa;
207        aa=legend('OLR VP1-2','OLR NOAA');
208        set (aa,'fontsize',8,'Position',[0.6800 0.1039 0.1270 0.1642])
209        legend boxoff;
210     end;
211     axis([1 122 -15 15]);
212     set (gca,'YTick',[-15:5:15],'YTickLabel',[-15:5:15],'fontname','Arial','fontsize',6);
213   set (gca,'XTick',[10:10:122],'XTickLabel',[10:10:122],'fontname','Arial','fontsize',6);
214
215end;
216
217figure(1);
218fullfilename=[IRCAAM_OD,'reconstitution1_eof12_filtreER_',df,'.eps'];
219print('-depsc2',fullfilename);
220clear fullfilename;
221
222figure(2);
223fullfilename=[IRCAAM_OD,'reconstitution2_eof12_filtreER_',df,'.eps'];
224print('-depsc2',fullfilename);
225clear fullfilename;
226
227figure(3);
228fullfilename=[IRCAAM_OD,'reconstitution3_eof12_filtreER_',df,'.eps'];
229print('-depsc2',fullfilename);
230clear fullfilename;
Note: See TracBrowser for help on using the repository browser.