%% Confirm model-data spatial registration
define_paths;

%% COMPARE DEPTH MEASUREMENTS
% Load processed dataset
load('sim_estimates_model_v1_0min_sensor_avg.mat');

% For field data
% SWIFT.D = SWIFT-based adcp-measured depth
% SWIFT.DQ = model depth at interpolated at location of adcp measurement

% SK.D = Station-keeping-based adcp-measured depth
% SK.DQ = model depth at interpolated at location of adcp measurement


%% FIGURE 2 - Plot Comparison of Bathymetry Measurements
f2 = figure(2); clf(f2); f2.Color = 'w';
f2.Units = 'inches';
f2.Position = [1,1, 3.9, 3.8];
clines = lines(7);
plot([0, 21], [0, 21], 'Color',0.5*[1,1,1], 'LineWidth', 2); hold on;
SWIFT.D(abs(SWIFT.D-SWIFT.DQ)>5) = nan;
p1 = plot(SWIFT.D(:,1), SWIFT.DQ(:,1), '.', 'Color', clines(1,:) ); 
p2 = plot(SK.D(:,1), SK.DQ(:,1), '.', 'Color', clines(2,:)); 
pleg(1) = plot(NaN, NaN, '.', 'Color', clines(1,:), 'MarkerSize',16);
pleg(2) = plot(NaN, NaN, '.', 'Color', clines(2,:), 'MarkerSize',16);
xlim([0, 21]);
ylim([0, 21]);
%title('Comparison of measured vs. model water depth');
xlabel('Measured depth [m]');
ylabel('Model depth [m]');
grid on;
legend([pleg],{'SWIFT ADCP (drifting)','Vessel ADCP (station-keeping)'},...
    'Box','off','Location','NorthWest')
mean_diff_SW = nanmean(SWIFT.D(:,1)-SWIFT.DQ(:,1));
mean_diff_SK = nanmean(SK.D(:,1)-SK.DQ(:,1));
axis equal;
xlim([0, 20]);
ylim([0, 20]);
ax = gca;
ax.Position = [0.11, 0.13, 0.85, 0.85];
print(f2, fullfile(dirFig, 'bathy_check'), '-djpeg', '-r600');




