function time_serie_ER_rossby_df_complet(period1, period2)
% time_serie_ER_rossby_df_complet ++explication between period1 days and period2 days

%+
%
%  .. _time_serie_ER_rossby_df_complet.m:
%
% =================================
% time_serie_ER_rossby_df_complet.m
% =================================
%
% ++
%
% DESCRIPTION
% ===========
%
% plot ++ from file :file:`eof_rossby_jjas_2006_10-30d.mat`
%
% EXAMPLES
% ========
%
% Following line read :file:`eof_rossby_jjas_2006_10-30d.mat`, plot ++and produce Postscript files :file:`time_serie_eof_ER_10-30d_part*.eps`.
%
% ::
%
% >> time_serie_ER_rossby_df_complet(10,30);
%
% SEE ALSO
% ========
%
% :ref:`olr_eof_jjas2006_rossby_df.m`
%
% :ref:`carte_eofER_1030_article.m`
%
% :ref:`carte_eof_ER_jjas_df.m`
%
% :ref:`time_serie_ER_rossby_df.m`
%
% TODO
% ====
%
% improve description
%
% improve file pb
%
% use return function
%
% EVOLUTIONS
% ==========
%
% $Id$
%
% - fplod 2009-02-11T16:27:34Z aedon.locean-ipsl.upmc.fr (Darwin)
%
%   * add try/catch on opening file for reading
%
% - fplod 2009-02-10T14:28:00Z aedon.locean-ipsl.upmc.fr (Darwin)
%
%   * replace ndmin by period1 and ndmax by period2
%
% - fplod 2009-01-27T11:51:31Z aedon.locean-ipsl.upmc.fr (Darwin)
%
%   * created from time_serie_ER_rossby_1030_complet.m to replace it as well as
%     time_serie_ER_rossby_30100_complet.m
%
%     Days will be now written ``period1``\-``period2d`` (ex: 10-30d) in filenames.
%
%-

global IRCAAM_ID;
global IRCAAM_OD;

if nargin==2
 % period1 must be lower than period2
 if (period1 > period2)
  disp(['period1 = ', int2str(period1)]);
  disp(['period2 = ', int2str(period2)]);
  error('eee : period1 must be lower than period2');
 end
else
  usage='usage : time_serie_ER_rossby_df(period1, period2)';
  disp(usage);
  error('eee : wrong arguments numbers')
end

% period1 and period2 will be used in xx-yyd form in filenames
df = [int2str(period1),'-',int2str(period2),'d'];
clear period1;
clear period2;

close all;

figure(1);
orient('landscape')
figure(2);
orient('landscape')
figure(3);
orient('landscape')

fullfilename=[IRCAAM_ID,'eof_rossby_jjas_2006_',df,'.mat'];
try
 status=load(fullfilename,'C','olr');
catch
 error('eee : File %s not found\n', fullfilename);
end

clear fullfilename;
C=status.C;
olr=status.olr;
clear status;

olr=olr';
PC1=olr*C;

time_serie_olr1=PC1(:,425);
time_serie_olr2=PC1(:,424);

for a=1:28;
   if a<12;
      figure(1);
      subplot(4,3,a);
   elseif a<23;
      figure(2);
      subplot(4,3,a-11);
   else
      figure(3);
      subplot(4,3,a-22);
   end;
   clear koro1
   debut=(a-1)*122+1;
   fin=a*122;
   koro1=time_serie_olr1(debut:fin);
   koro2=time_serie_olr2(debut:fin);
   x=[1:122]';
   aa=plot(x,-koro1,'r');
   hold on;
   bb=plot(x,-koro2,'k');
%   cc=legend('EOF1','EOF2')
%   set (cc,'fontsize',6)
%   legend boxoff;
   y=zeros(122,1);
   plot(x,y,'k:');
   if a==2;
       text(0,183,['time series EOF1 and EOF2 OLR ER ' df]);
   elseif a==13;
       text(0,183,['time series EOF1 and EOF2 OLR ER ' df]);
   elseif a==24;
       text(0,183,['time series EOF1 and EOF2 OLR ER ' df]);
   end;
   title(a+1978,'FontSize',8);
   set (gca,'tickDir','out');
axis([1 122 -100 100]);

set (gca,'YTick',[-100:20:100],'YTickLabel',[-100:20:100],'fontname','Arial','fontsize',6);
set (gca,'XTick',[0:20:120],'XTickLabel',[0:20:120],'fontname','Arial','fontsize',6);
end;

figure(1);
fullfilename=[IRCAAM_OD,'time_serie_eof_ER_',df,'_part1.eps'];
print('-depsc2',fullfilename);
figure(2);
fullfilename=[IRCAAM_OD,'time_serie_eof_ER_',df,'_part2.eps'];
print('-depsc2',fullfilename);
figure(3);
fullfilename=[IRCAAM_OD,'time_serie_eof_ER_',df,'_part3.eps'];
print('-depsc2',fullfilename);
