% look_ctd_ros.m; Ledwell; 9/8/05
function look_ctd_ros(i)
% looks at properties near the target surface

s=int2str(i);
if length(s)==1
    s=['0',s];
end

eval(['load Y:\oc415_4\ctd\process\oc4154',s])

% c0     chl    o2     press  s0     t0    c1     par      s1     t1 
[Pmax,n]=max(press);
k=1:n;
P=press(k);
S=s0(k);
T=t0(k);
C=chl(k);

sigma=sw_pden(S,T,P,0)-1000;
theta=sw_ptmp(S,T,P,0);

Tx=5;
Sx=20;
Tr=19;
Sr=26.2;
sigscl=Sx*(sigma-Sr);
thscl=Tx*(theta-Tr);

figure(1); clf
plot(sigscl,P,C,P,thscl,P)
legend('Chl','Sigma','Theta')
set(gca,'ydir','reverse')
axis([0 3 60 120])

x=ginput
pmax=x(1,2)
maxchl=x(1,1)
theta0=x(2,1)/Tx+Tr
sigma0=x(3,1)/Sx+Sr

