%% Quick script to show before after


%%% Options
savefigs=1; % 1 to save figures


%% load data
Mpath='F:\check_outs\tudelft\vlugtenburg\';

NetCDFfilename=[Mpath '\Vlugtenburg.nc'];
line=7 % number of transect line(s) 2 be extracted (value(s) between 1 and 22)

survey_ind = list_surveys;

[cross_shore,altitude] = combine_surveys_nr(survey_ind,1,line);
[cross_shore,altitude2] = combine_surveys_nr(survey_ind,38,line);
for line=1:22
[cross_shore,altitude_t(:,line)] = combine_surveys_nr(survey_ind,1,line);
 [cross_shore,altitude_t2(:,line)] = combine_surveys_nr(survey_ind,38,line) ;  
end
    
    
    % x=nc_varget(NetCDFfilename,'cross_shore',[0],[-1]);
% alt=nc_varget(NetCDFfilename,'altitude',[date-1 line-1 0],[1 1 -1]);   % index -1 because netcdf starts counting at zero.. Weird Yanks.

%%
cmap=colormap(jet)
figure
set(gcf,'position',[ 428   388   660   305])
    set(gcf,'PaperPosition',[0 0  25 10]*0.7)
hold all 
    plot(cross_shore,altitude,'--','color',1/255*[135 50 32],'linewidth',2)
     %  plot(cross_shore,nanmean(altitude_t'),'color',cmap(1,:),'linewidth',1)
    plot(cross_shore,altitude2,'color',1/255*[ 87 135 32],'linewidth',2)
     %   plot(cross_shore,nanmean(altitude_t2'),'color',cmap(end,:),'linewidth',1)
    plot([197 1480],[0 0],'b')
    plot([135 197],[0 0],'-.b')
     plot([-300 135],[0 0],':b')
    plot([0 0],[4.35 6],'k','linewidth',2)
    plot([0 0 0],[5 5.5 6],'xk')
    
 plot(cross_shore,altitude2-altitude,'--','color',1/255*[135 50 32],'linewidth',2)
     %  plot(cross_shore,nanmean(altitude_t'),'color',cmap(1,:),'linewidth',1)
   
% 
%     indp=[61:301];
%     pro=altitude;
%     xp=[0 0 cross_shore(indp)' cross_shore(indp(end))'];
%     yp=[-10 4.5 pro(indp)' -10];
%     tcolor(1,1,1:3) = 0.6*[1 1 1];
%     patch(xp,yp,tcolor,'facealpha',0.4,'EdgeColor','k')

    grid on

set(gca,'XDir','reverse');
xlim([-250 1500])
ylim([-10.5 12.5])
% 
%    set(gca,'xtick',[0:100:1200])
%     set(gca,'ytick',[-10:2:5])
%     
xlabel('Cross-shore distance [m]')
ylabel('Profile elevation wrt NAP [m]')
  if savefigs==1
        filename=[ 'TransectExample']
        print ([ Mpath 'scripts\Matthieu\ProfileAnalysis\images\' filename '.jpg'],'-djpeg')
    end


