% File to show the similarity in response between the profiles 

%%
savefigs=1; %Toggle 
%% Load
Mpath='F:\check_outs\tudelft\vlugtenburg\scripts\Matthieu'
%Mpath='C:\Madeschipper\check_out\OpenEarthRawData\tudelft\vlugtenburg\scripts\Matthieu'

load([Mpath '\MakeTopo\AllVbeachsurveys.mat'])
load([Mpath '\MakeTopo\datesandpairs.mat'])

%% sed/Eros between consecutive surveys
for i_date=2:length(Vsurvey)

Vsurvey(i_date).SedEro.grid_r=Vsurvey(i_date).grids.Zi_r-Vsurvey(i_date-1).grids.Zi_r;
Vsurvey(i_date).SedEro.transects=Vsurvey(i_date).transects.elevation-Vsurvey(i_date-1).transects.elevation;
end

 %% Topview SedEro
for i_date=2:length(Vsurvey)
 
figure(12)
subplot(121)
set(gcf,'PaperPosition',[0  0  40 20])
 set(gcf,'Position',[1          31        1680         944])
 pcolor(Vsurvey(i_date).grids.Xi_r,Vsurvey(i_date).grids.Yi_r,Vsurvey(i_date).SedEro.grid_r)
 shading flat
ylim([0 1200])
caxis([-1 1])
colorbar
hold all
[C,h] = contour(Vsurvey(i_date).grids.Xi_r,Vsurvey(i_date).grids.Yi_r,Vsurvey(i_date).grids.Zi_r,[-9:1:4],'--k');
clabel(C,h,'LabelSpacing',72,'FontSize',10,'Color','k','Rotation',0) ;
legend('sed (r) /eros (b) [m]',[ 'contour ' Vsurvey(i_date).date([4:6 1:3 7:10])] )
title([ 'Sed Erosion survey  ' Vsurvey(i_date).date([1:3 7:10]) ' - ' Vsurvey(i_date-1).date([1:3 7:10]) ' , based on the grid'])

hold off

subplot(122)
set(gcf,'PaperPosition',[0  0  40 20])
 set(gcf,'Position',[1          31        1680         944])
 pcolor(22:-1:1,Vsurvey(i_date).transects.cr_sh,Vsurvey(i_date).SedEro.transects)
 shading flat
ylim([0 1200])
caxis([-1 1])
colorbar
hold all
[C,h] = contour([22:-1:1],Vsurvey(i_date).transects.cr_sh,Vsurvey(i_date).transects.elevation,[-9:1:4],'--k');
clabel(C,h,'LabelSpacing',72,'FontSize',10,'Color','k','Rotation',0) ;

legend('sed (r) /eros (b) [m]',[ 'contour ' Vsurvey(i_date).date([4:6 1:3 7:10])] )
title([ 'Sed Erosion survey  ' Vsurvey(i_date).date([1:3 7:10]) ' - ' Vsurvey(i_date-1).date([1:3 7:10]) ' , based on the transects'])

hold off




if savefigs==1
filename=[ 'Grid and Transect Sed Erosion survey  ' Vsurvey(i_date).date([7:10]) '_' Vsurvey(i_date).date([1:2]) '_' Vsurvey(i_date).date([4:5]) ]
print ([ Mpath '\images\' filename '.jpg'],'-djpeg')
end
end

