%  plotSsig.m - plot vertical profile of salinity versus density.
%    needs variables set:  DataDir CruiseName DepthResolution ctdcastlist 
%                         srange sigrange InfoString RefPress
%    sets variables: none
%    calls: readctd potentialtemp swstate
S=[0 1];
Pden=[0 1];

figure;

plot(S,Pden);
axis([srange sigrange]);
title('Salinity vs Potential Density ');
xlabel('Salinity');
ylabel('Density [Sigma]');
text(srange(1)+.1*(srange(2)-srange(1)),...
     sigrange(1)+.85*(sigrange(2)-sigrange(1)),InfoString);
text(srange(1)+.1*(srange(2)-srange(1)),...
     sigrange(1)+.8*(sigrange(2)-sigrange(1)),CruiseName);
hold on;

for cast = ctdcastlist
  file= [DataDir '/' CruiseName '/Ctd/' DepthResolution '/ctd' castnum(cast) '.dat'];
   [nlines,ndepths,desc,p,t,s,pt,r0,r1,bv,t0,t1,s0,s1,o2,par,tr,fl] = readctd(file);
  PT=potentialtemp(s,t,p,RefPress);
  [SVAN,Pden]=swstate(s,PT,RefPress);
  plot(s,Pden);
end

hold off;

