
if ~exist('oxy')
    load ctd_xbt_merged
end;

if ~exist('gam');
    gam=gamman(sal,temp,p,lon,lat);
end;

gam2=sort(nanmean2(gam,2));
gam2=gam2(1:1000);
oxy2=NaN*ones(length(gam2),length(lat));

for i=1:length(lat);
    [g,ind]=sort(gam(:,i));
    o=oxy(:,i);
    o=o(ind);
    q=find(diff(g)<1e-7);
    while length(q)
        o(q)=[]; g(q)=[]; q=find(diff(g)<1e-7);
    end;
    q=find(g>=min(gam2) & g<=max(gam2));
    g=g(q); o=o(q);
    q=find(gam2>=min(g) & gam2<=max(g));
    oxy2(q,i)=interp1(g,o,gam2(q),'linear');
end;
q=find(gam2>27);
oxy2(q,:)=fillnans(oxy2(q,:),0);

clf;
C=c_oxygen;
colormap([[1 1 1];[c_oxygen]]);
subplot(211);
patchmap(lat,p,oxy,[.85 5]);
set(gca,'ydir','reverse');
title('oxygen (mL/L) at 23^\circW, May-June 2006 (PNE06, R/V RHBrown)')
ylabel('dbar');
subplot(212);
patchmap(lat,gam2,oxy2,[.85 5]);
set(gca,'ydir','reverse');
xlabel('^\circN');
ylabel('\gamma^n');

