% make new y.cgrid without oscillations near equator

clear all, clf reset
cd /dm1/dimitri/matlab/mitgcm/grid
load y.cgrid.old.notext

lat=y(:,1);
ny=length(lat);
dy=y(:,2);
dy_lat=-80+cumsum(dy);
dy_lat([54 55 112 113 170 171])

new_dy=dy;
new_dy(79:147)=0.3;
new_dy(55)=dy(55)-2.48e-04;
new_dy(171)=dy(171)-2.48e-04;;
new_dy_lat=-80+cumsum(new_dy);
new_dy_lat([54 55 112 113 170 171])

new_lat=([-80; new_dy_lat(1:(ny-1))]+new_dy_lat)/2;
new_lat([54 55 112 113 114 170 171])

delete y.cgrid
fid=fopen('y.cgrid','wt')
fprintf(fid,'     Y            Delta Y\n')
fprintf(fid,'%12.7f %12.7f\n',[new_lat new_dy]')
fclose(fid)
