%% profile plot
figure
year = 2009;
month = 7
plot(cross_shore,altitude(:,1),'b',...
    'DisplayName', datestr(datenum(num2str([month year]),'mm yyyy'),'mmmm yy'),...
    'linewidth',2);
hold all
year= 2010;
month = 3
plot(cross_shore,altitude(:,end),'r',...
    'DisplayName', datestr(datenum(num2str([month year]),'mm yyyy'),'mmmm yy'),...
    'linewidth',2);
legend show
hline(0,'c:')

title('Profile 7')

xlabel('Cross Shore [m]')
ylabel('Elevation wrt NAP [m]')
xlim([-350 1500])

set(gcf,'position',[360 611 792 311])

% rectangle('Position',[-300,-2,550,16],...
%          'LineWidth',2,'LineStyle','--')
     
%      xlim([-300 250])
%      ylim([-2 14])

%% plot difference
figure
plot(cross_shore,altitude(:,end)-altitude(:,1),'g','linewidth',2)
hline(0)
     xlim([-300 250])

%% Beach settling
for i = 1:min(size(altitude))
    delta_beach(i) = mean(altitude((cross_shore>10 & cross_shore<70),1)-...
        altitude((cross_shore>10 & cross_shore<70),i));
end

plot(delta_beach, 'DisplayName', 'delta', 'YDataSource', 'delta'); figure(gcf)

%% base dune settling
delta2 = (altitude((cross_shore>-100 & cross_shore<0),1)-...
    altitude((cross_shore>-100 & cross_shore<0),9))


[dum, index] = min(altitude((cross_shore>-100 & cross_shore<0),1)-...
    altitude((cross_shore>-100 & cross_shore<0),9))
cross_shore2 = cross_shore(cross_shore>-100 & cross_shore<0);
cross_shore2(index)

index = find(cross_shore == -80)

for i = 1:min(size(altitude))
    delta_BD(i) = (altitude(index,1)-...
        altitude(index,i));
end

plot(delta_BD, 'DisplayName', 'delta_BD', 'YDataSource', 'delta_BD'); figure(gcf)

%% Dune valley
for i = 1:min(size(altitude))
    delta_valley(i) = mean(altitude((cross_shore>-140 & cross_shore<-90),1)-...
        altitude((cross_shore>-140 & cross_shore<-90),i));
end

figure
plot(delta_valley, 'DisplayName', 'delta', 'YDataSource', 'delta'); figure(gcf)



