clear all
close all

nx=360; ny=160; ntim=12;
for ityp=1:2,
 if (ityp==1), tstr='edp'; end
 if (ityp==2), tstr='esp'; end
 for il=1:13,
   if (il<10),
    fid=fopen(['OASIM_wrong/ecco_oasim2_',tstr,'0',num2str(il),'_below.bin'],'r','b');
   else
    fid=fopen(['OASIM_wrong/ecco_oasim2_',tstr,num2str(il),'_below.bin'],'r','b');
   end % if 
   field=fread(fid,'float32'); fclose(fid);
   field=reshape(field,nx,ny,ntim);
%%
   for it=1:12,
    tmp=squeeze(field(:,:,it));
    newtmp(1:180,:)=tmp(181:360,:);
    newtmp(181:360,:)=tmp(1:180,:);
    newfield(:,:,it)=newtmp;
%%
 % plot
    if (it==1),
     if (il==2),
      subplot(2,1,1), pcolor(tmp'); shading flat, colorbar
      subplot(2,1,2), pcolor(newtmp'); shading flat, colorbar
     end % if
    end % if it
%%
   if (il<10),
    fid=fopen(['OASIM_fix/ecco_oasim2_',tstr,'0',num2str(il),'_below.bin'],'w','b');
   else
    fid=fopen(['OASIM_fix/ecco_oasim2_',tstr,num2str(il),'_below.bin'],'w','b');
   end % if 
   fwrite(fid,newfield,'float32'); fclose(fid);
%%%
   end % for it
 end % for il
end % for ityp
