
overlay_casts=1;    % set to 1 to overlay the positions of the casts

zmax=NaN*ones(size(lat));
for i=1:length(lat);
    q=find(isfinite(temp(:,i)));
    zmax(i)=max(p(q));
end;

% temperature
figure;
C=colormap(jet);
C(1:10,3)=C(1:10,3)-C(1,3)*(9:-1:0)'/20;
C(1:10,2)=C(1:10,2)-C(1,2)*(9:-1:0)'/20;
colormap(C);
contourf(lat,p,fillnans(temp,0),[min(min(temp)):.1:max(max(temp))])
shading flat;
colorbarvert;
hold on;
h=contour(lat,p,fillnans(temp,0), ...
    floor(min(min(temp))):ceil(max(max(temp))),'k');
set(gca,'ydir','reverse','tickdir','out');
%clabel(h,'manual');
if overlay_casts
    overlaycasts(lat,zmax);
end;
hold off;
set(gca,'xtick',-5:5:20);
set(gca,'xticklabel',[' 5S';' 0 ';' 5N';'10N';'15N';'20N'])
ylabel('depth (dbar)')
title('temperature (^\circC) at 23^\circW in May-June 2006 (RB0605a)','fontsize',12)
orient landscape;

% salinity
figure;
C=c_salinity;
C(1:10,3)=C(1:10,3)-C(1,3)*(9:-1:0)'/9;
C(1:10,2)=C(1:10,2)-C(1,2)*(9:-1:0)'/20;
colormap(C);
contourf(lat,p,fillnans(sal,0),[min(min(sal)):.01:max(max(sal))])
shading flat;
colorbarvert;
hold on;
h=contour(lat,p,fillnans(sal,0),34.5:.2:38,'k');
set(gca,'ydir','reverse','tickdir','out');
%clabel(h,'manual');
if overlay_casts
    overlaycasts(lat,zmax);
end;
hold off;
set(gca,'xtick',-5:5:20);
set(gca,'xticklabel',[' 5S';' 0 ';' 5N';'10N';'15N';'20N'])
ylabel('depth (dbar)')
title('salinity (psu) at 23^\circW in May-June 2006 (RB0605a)','fontsize',12)
orient landscape;

% oxygen
figure;
C=c_oxygen;
C(1:10,3)=C(1:10,3)-C(1,3)*(9:-1:0)'/9;
C(1:10,2)=C(1:10,2)-C(1,2)*(9:-1:0)'/20;
colormap(C);
contourf(lat,p,fillnans(oxy,0),[.88:.05:5]);
shading flat;
colorbarvert;
hold on;
h=contour(lat,p,fillnans(oxy,0),.8:.2:5,'k');
set(gca,'ydir','reverse','tickdir','out');
%clabel(h,'manual');
if overlay_casts
    overlaycasts(lat,zmax);
end;
hold off;
set(gca,'xtick',-5:5:20);
set(gca,'xticklabel',[' 5S';' 0 ';' 5N';'10N';'15N';'20N'])
ylabel('depth (dbar)')
title('oxygen (mL/L) at 23^\circW in May-June 2006 (RB0605a)','fontsize',12)
orient landscape;
