%% Simple example to plot a topview of the data
clear all
close all
savefigs=1; %Toggle

% Load

Mpath='F:\check_outs\tudelft\vlugtenburg\'
%Mpath='C:\Madeschipper\check_out\OpenEarthRawData\tudelft\vlugtenburg\'


load([Mpath 'AllVbeachsurveys.mat'])

load('cmapVBmin10to5.mat')

%% plot gridded (from transects) data
 figure(234)%('Color',[1 1 1])
       set(gcf,'PaperPosition',[0  0  40 33])
        set(gcf,'Position',[363    72   969   880])

 
        i_date_plot=[     1 4 7 10 13 15 18 21 24 27 30 33 35  ]
        rij=[1 1 2 2 2 2 3 3 3 3 4 4 4]
        kolom=[3 4 1 2 3 4 1 2 3 4 1 2 3]
 i=0;
    for plotnr=1:length(rij)
       i=i+1;
       subplot(4,4,(rij(plotnr)-1)*4+kolom(plotnr))
        i_date=i_date_plot(plotnr) 
     
        pk=pcolor(Vsurvey(i_date).transects.y,Vsurvey(i_date).transects.cr_sh,Vsurvey(i_date).transects.elevation)
        hold all
        
        [C,h] = contour(Vsurvey(i_date).transects.y,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) ;
        
        shading flat
        hold all
        
     %   set(gca,'Xtick',[flipud(Vsurvey(i_date).transects.y)])
     %   set(gca,'Xticklabel',num2str([flipud(Vsurvey(i_date).transects.y)],'%4.0f'))
        
        xlim([0 1750])
        
      
        
        ylim([0 1200])
        if i==length(rij)-2
              xlabel('Alongshore distance [m]')
              ylabel('Cross shore distance [m]')
        end
        
        caxis([-10 5])
        %colorbar
        colormap(cmap)
       % set(gca,'position',[0.1300    0.1100    0.7750    0.8150])
       % legend([pk  h], 'Elevation [m]',[ 'contour ' Vsurvey(i_date).date([4:6 1:3 7:10])] )
        title([ 'Topography survey  ' Vsurvey(i_date).date([1:3 7:10]) ])
        
        
        x0=30;           y0=1050;  theta0 =-131.65534968173412+90;
        h=100; w=100 ;
        [x_ds3,y_ds3]=northarrow(h,w,x0,y0,theta0);
        
  
    end
      set(gcf,'renderer','zbuffer')
    set (gcf,'color','w')
      hold off
        drawnow
        if savefigs==1
            print ([ 'EvolutionTopo16.png'],'-dpng')
        end
        