
   clear all; close all;

   ys_fich=2003;
   ye_fich=2007;         

   exp(1).config='peru12_nemo';
%  exp(1).names={'p12n_bdy_tr12n_quik' 'p12n_bdy_soda2' 'p12n_bdy_soda2_B' 'erai70b' 'erai74c' 'p12n_bdy_tr12n_quik_ND' 'p12n_bdy_tr12n_quik_blp1'};   
%  exp(1).names={'erai70a' 'erai70b' 'erai70c' 'erai72c' 'erai73c' 'erai73c2' 'erai74c' 'erai75c'};
   exp(1).names={'p12n_bdy_soda2_B_steps' 'p12n_bdy_soda2_B_rfact'};   

   exp(2).config='trop12_nemo/peru';
   exp(2).names={'tr12_quik' 'tr12_erainocrt'};

   exp(3).config='trop025peru12_nemo/peru';
   exp(3).names={'tr025p12_quik'};

   exp(4).config='/loceanfs/pulsation/cholod/data/TMI-AMSR-E/';
   exp(4).names={'TMI-AMSR-E_PERU12'};

   mini=17;
   maxi=28;

   exp_dim=size(exp);
%  for ii = 1:exp_dim(2)
   for ii = 1:1                    % config
      config=exp(ii).config;
      names=exp(ii).names;
      names_dim=size(names);

%     for jj = 1:names_dim(2);     % names
      for jj = 1:2
         name=names{jj};
         name_title=regexprep(name,'_','\\_');
         disp([num2str(jj) ' : ' config ' : ' name]);
         rep_fich=[num2str(ys_fich) '0101_' num2str(ye_fich) '1231'];
         dur_plot=[num2str(ys_fich) '-' num2str(ye_fich)];
         maskfile='/loceanfs/pulsation/cholod/peru12_nemo/inputs/grd/mesh_mask_peru12.L75_from_trop12.nc';
         if strcmp(name,'TMI-AMSR-E_PERU12')
            dir_in=config;
            filetos=[dir_in name '_' dur_plot '_mean.nc']
         else
            dir_in=['/loceanfs/pulsation/cholod/' config '/outputs/' name '/' rep_fich '/'];
            filetos=[dir_in name '_1s_' rep_fich '_grid_T_2D.nc']
         end


%%% coord et mask  de la grille
         ng=netcdf(maskfile,'r');
         lon=ng{'glamt'}(:);
         lat=ng{'gphit'}(:);
         mask=squeeze(ng{'tmask'}(:,1,:,:));
         mask(mask==0)=NaN;
         close(ng);

%%% Lecture tos
         nz=netcdf(filetos,'r'); 
         if ii == 4
            tos=nz{'sst'}(:,:);
         else
            tos=nz{'tos'}(5,:,:);
         end
         close(nz);

%%%  Plot 1
         figure;
         pcolor(lon(:,1:361),lat(:,1:361),tos(:,1:361).*mask(:,:)); shading flat;
  lon1 = -79.67;
  lat1 = -7.065;
  lon2 = -76.33;
  lat2 = -13.05;
  lon1b = -82.42;
  lon2b = -79.08;
  line([lon1b lon1],[lat1 lat1],'color','k','LineWidth',1)
  line([lon2b lon2],[lat2 lat2],'color','k','LineWidth',1)
  line([lon1b lon2b],[lat1 lat2],'color','k','LineWidth',1)
         set(gca,'FontS',14); set(gca,'PlotBoxAspectRatio',[0.7 1 1]); box on;
         caxis ([mini maxi]); hcc=colorbar; set(hcc,'FontS',14);
         title(['sst mean (C) - ' name_title ' (' dur_plot ')'],'FontSize',12);
         figname1=['map_sst_mean_' name '_' dur_plot];
         print ('-dpng',figname1)

      end
   end
      


