% This script generates a series of plots:  T vs depth, S versus depth, and
% flourometer versus depth.  What is unique is that it offsets each yoyo
% pair so that the difference between up and down casts is highlighted.  
%
% This routine assumes that 'fix_depth' has been run, and that the variables
% yoyo and d_rate have been generated.  It also assumes that fix_ctd has been
% run and that sal is available...
%
%   J. G. Bellingham
%   December 26, 1998

% Temperature...
figure
if ~exist('cascade_t'),
   cascade_t = 0.5;
end

set( gcf, 'name', 'Temperature Cascade Plot' );
hold on;
for i = 1:max(yoyo),
   oku = find((yoyo == i) & (d_rate < -0.1));
   okd = find((yoyo == i) & (d_rate > 0.1));
   plot(data(oku, water_temp)+cascade_t*i, data(oku, m_depth), 'r-');
   plot(data(okd, water_temp)+cascade_t*i, data(okd, m_depth), 'b-');
end
set(gca, 'ydir', 'reverse', 'ylim', [0 inf] )
hold off;
grid on;
zoom on;

% Salinity...
figure
if ~exist('cascade_s'),
   cascade_s = 0.2;
end

set( gcf, 'name', 'Salinity Cascade Plot' );
hold on;
for i = 1:max(yoyo),
   oku = find((yoyo == i) & (d_rate < -0.1));
   okd = find((yoyo == i) & (d_rate > 0.1));
   plot(sal(oku)+cascade_s*i, data(oku, m_depth), 'r-');
   plot(sal(okd)+cascade_s*i, data(okd, m_depth), 'b-');
end
set(gca, 'ydir', 'reverse', 'ylim', [0 inf] )
hold off;
grid on;
zoom on;

