
switch ('learn')
   case 'assim'
      error_files = {'../../Save_Class2/img/Bottom_Gravity_Current_045/errors.dat' ...
                     '../../Save_GMM_M001/img/BGC_006/errors.dat' };
      labels = {'DO' ...
                'GMM-DO' };
      ttl_str = 'S_{init} = exp(8)';
      xlims = [30 43];
   case 'assim4'
      error_files = {'../../Save_Class2/img/Bottom_Gravity_Current_045/errors.dat' ...
                     '../../Save_GMM04_M001/img/BGC_006/errors.dat' ...
                     '../../Save_GMM04_M005/img/BGC_006/errors.dat' ...
                     };
      labels = {'DO' ...
                'GMM-DO, M=1' ...
                'GMM-DO, M=5' ...
                };
      ttl_str = 'S_{init} = exp(8)';
      xlims = [29 43];

   case 'learn'
      %GMMstr='GMM';
      %GMMstr='GMM02';
      GMMstr='GMM04';
      GMM_M=5;mstr=num2str(GMM_M,'%3.3d');
      error_files = { ...
               ['../../Save_',GMMstr,'_M',mstr,'/img/BGC_001/errors.dat'] ...
               ['../../Save_',GMMstr,'_M',mstr,'/img/BGC_002/errors.dat'] ...
               ['../../Save_',GMMstr,'_M',mstr,'/img/BGC_003/errors.dat'] ...
               ['../../Save_',GMMstr,'_M',mstr,'/img/BGC_004/errors.dat'] ...
               ['../../Save_',GMMstr,'_M',mstr,'/img/BGC_005/errors.dat'] ...
               ['../../Save_',GMMstr,'_M',mstr,'/img/BGC_006/errors.dat'] ...
               ['../../Save_',GMMstr,'_M',mstr,'/img/BGC_007/errors.dat'] ...
               ['../../Save_',GMMstr,'_M',mstr,'/img/BGC_008/errors.dat'] ...
               ['../../Save_',GMMstr,'_M',mstr,'/img/BGC_009/errors.dat'] ...
               ['../../Save_',GMMstr,'_M',mstr,'/img/BGC_010/errors.dat'] ...
               ['../../Save_',GMMstr,'_M',mstr,'/img/BGC_011/errors.dat'] };
      labels = { ...
                '1' ...
                '2' ...
                '3' ...
                '4' ...
                '5' ...
                '6' ...
                      '7' ...
                '8' ...
                '9' ...
                '10' ...
                '11' ...
                };
      %ttl_str = ['GMM-DO, M=',num2str(GMM_M)];
      ttl_str = 'GMM-DO';
      xlims = [30 43];
end;


colors='brgkmc';
ncolors = length(colors);
line_styles = {'-' '--' ':' '.-'};
nlines = length(line_styles);
hndr=[];
hndu=[];
hndv=[];

for n = 1:length(error_files)

   [time,u_errors,v_errors,rho_errors] = err_read (error_files{n});

   if ( exist(strrep(error_files{n},'errors','errors_pos'),'file') == 2 )
      [time_pos,u_errors_pos,v_errors_pos,rho_errors_pos] = err_read (strrep(error_files{n},'errors','errors_pos'));
      [time,u_errors,v_errors,rho_errors] = err_merge (time,u_errors,v_errors,rho_errors, ...
                                                       time_pos,u_errors_pos,v_errors_pos,rho_errors_pos);
   end;

   figure(1)
   hndr(n)=plot(time,rho_errors.rms,[colors(rem(n-1,ncolors)+1),line_styles{rem(fix((n-1)/ncolors),nlines)+1}]); hold on;

   figure(2)
   hndu(n)=plot(time,u_errors.rms,[colors(rem(n-1,ncolors)+1),line_styles{rem(fix((n-1)/ncolors),nlines)+1}]); hold on;

   figure(3)
   hndv(n)=plot(time,v_errors.rms,[colors(rem(n-1,ncolors)+1),line_styles{rem(fix((n-1)/ncolors),nlines)+1}]); hold on;
end;

figure(1);
set (gca,'FontWeight','Bold');
title(['S RMS-errors:  ',ttl_str]);
set (hndr,'LineWidth',2);
if ~isempty(xlims);
   set(gca,'XLim',xlims);
end;
legend(labels,'Location','Best');

figure(2);
set (gca,'FontWeight','Bold');
title(['U RMS-errors:  ',ttl_str]);
set (hndu,'LineWidth',2);
if ~isempty(xlims);
   set(gca,'XLim',xlims);
end;
legend(labels,'Location','Best');

figure(3);
set (gca,'FontWeight','Bold');
title(['V RMS-errors:  ',ttl_str]);
set (hndv,'LineWidth',2);
if ~isempty(xlims);
   set(gca,'XLim',xlims);
end;
legend(labels,'Location','Best');

