clear all
close all

dirstr='/nfs/micklab001/jahn/forcing/oasim/C61extrap/below/';

for ir=1:13,
 if (ir<10), 
   filenam=[dirstr,'edsEd0',num2str(ir),'_2000'];
   newfilenam=['ecco_oasim2_edp0',num2str(ir),'_below.bin'];
 else
   filenam=[dirstr,'edsEd',num2str(ir),'_2000'];
   newfilenam=['ecco_oasim2_edp',num2str(ir),'_below.bin'];
 end % 
 fid=fopen(filenam,'r','b');
 field=fread(fid,'float32'); fclose(fid)
 field=reshape(field,360,180,12);
 figure(1), subplot(4,4,ir);  pcolor(squeeze(field(:,:,1))'); shading flat, colorbar
 newfield=squeeze(field(:,11:170,:));
 figure(2), subplot(4,4,ir);  pcolor(squeeze(newfield(:,:,1))'); shading flat, colorbar
%%  
 fid=fopen(newfilenam,'w','b');
 fwrite(fid,newfield,'float32'); fclose(fid);
%%%
 if (ir<10),
   filenam=[dirstr,'edsEs0',num2str(ir),'_2000'];
   newfilenam=['ecco_oasim2_esp0',num2str(ir),'_below.bin'];
 else
   filenam=[dirstr,'edsEs',num2str(ir),'_2000'];
   newfilenam=['ecco_oasim2_esp',num2str(ir),'_below.bin'];
 end % 
 fid=fopen(filenam,'r','b');
 field=fread(fid,'float32'); fclose(fid)
 field=reshape(field,360,180,12);
 figure(3), subplot(4,4,ir);  pcolor(squeeze(field(:,:,1))'); shading flat, colorbar
 newfield=squeeze(field(:,11:170,:));
 figure(4), subplot(4,4,ir);  pcolor(squeeze(newfield(:,:,1))'); shading flat, colorbar
%%  
 fid=fopen(newfilenam,'w','b');
 fwrite(fid,newfield,'float32'); fclose(fid);

end % for ir
