% MultiGrid.m
%
% SCRIPT:  Creates three interpolated grids of:  temperature, flourometer, and obs data.
%   Interpolation is in the vertical plane.  A forward speed of 1.3 m/s is assumed.  Grids
%   are displayed one above the other.
%   
% Related functions/scripts:  see SeriesGrid.m to created one grid set from a series of 
% missions.
%
%      J. G. Bellingham
%      December 29, 1998

% clear;
% x9827133; % Goes with 26811
% x9826811; % Goes with 27133
% x9827208; % Long run from Stellwagen
% x9826737  % Not so interesting - OBS obscurred.
% x9827135

close all;
figure;

% Correct depth for pitch angle.  Assume sensors 40 cm forward of depth sensor.
depth_wc = data(:, m_depth) + 0.30 * sin(data(:, m_pitch));

% Plot temperature...
subplot(3,1,1);
potgrid(1.3* data(:, m_present_time), depth_wc, data(:,water_temp), [100 50], [1 100]);
title('Temperature ');
colorbar;

% Lag fluormetry data.... 15 time cycle lag found to be fairly good estimate...
dn = 15; n = length(data); fl = data((dn+1):n,m_fl_voltage); fl((n-dn):n) = 0;
subplot(3,1,2);
potgrid(1.3*data(:, m_present_time), depth_wc, fl, [100 50], [1 100]);
title('Fluorometer');
colorbar;

if median(data(find(~isnan(data(:,m_bs_voltage))) ,m_bs_voltage)) < 4000
   subplot(3,1,3);
   potgrid(1.3*data(:, m_present_time), depth_wc, data(:,m_bs_voltage), [100 50], [1 100]);
   % caxis([0 2500]);
   title('Optical Backscatter');
   colorbar;
end;

% Put labels on figure...
h = axes('Position', [0 0 1 1], 'Visible', 'off');
set(gcf, 'currentaxes', h);
text(0.05, 0.97, strcat(run_name, 'OC 330'));
text(0.80, 0.97, 'MIT AUV Lab');
text(0.75, 0.03, 'J. G. Bellingham');
