%  plotSigmaz.m - plot vertical profile of potential density versus depth.
%    needs variables set: DataDir CruiseName DepthResolution ctdcastlist 
%                         sigrange deprange InfoString
%    sets variables: none
%    calls: readctd

Pden=[0 1];
dep=[0 1];
figure;

plot(Pden,dep);
axis([sigrange deprange]);

title('Potential Density vs depth');
xlabel('Density [Sigma]');
ylabel('Depth (m)');
text(sigrange(1) + .1*(sigrange(2)-sigrange(1)),.75*deprange(1),InfoString);
text(sigrange(1) + .1*(sigrange(2)-sigrange(1)),.81*deprange(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);
  dep=-p;
  pt=potentialtemp(s,t,p,RefPress);
  pr=RefPress * ones(size(p));
  [SVAN,Pden]=swstate(s,pt,RefPress);
  plot(Pden,dep);
end

hold off;
