clear all
close all
clc

korrel_dir = 'D:\werf_je\Werk\1.201.819-Proefsuppletie_Galgeplaat_2e_evaluatie\Data\Bodemsamenstelling';
load('D:\werf_je\Werk\1.201.819-Proefsuppletie_Galgeplaat_2e_evaluatie\Data_analyse\Cirkel_bestek\cb_data');
i = 0;
for file = dir(fullfile(korrel_dir,'*.xls'))'
    i = i + 1;
    if i == 1
        clear dum_xRD dum_yRD dum_D10 dum_D50 dum_D90 dum_zand dum_locaties xRD yRD D10 D50 D90 zand        
        clear num txt datum
        [num, txt]= xlsread(fullfile(korrel_dir,file.name),'SMExport 4.77');
        j = 2:17:length(txt(:,1))-7;
        dum_xRD = num(j,6);
        dum_yRD = num(j,7);
        dum_D10 = 1e-3*num(j,9);
        dum_D50 = 1e-3*num(j+2,9);
        dum_D90 = 1e-3*num(j+1,9);
        dum_zand = num(j-1,9) + num(j+4,9) + num(j+12,9) + num(j+15,9);
        dum_locaties = num(j,4);

        aloc = 16;
        for jj = 1:aloc
            clear dum
            dum = find(dum_locaties == jj);
            xRD(jj) = mean(dum_xRD(dum));
            yRD(jj) = mean(dum_yRD(dum));
            D10(jj) = mean(dum_D10(dum));
            D50(jj) = mean(dum_D50(dum));
            D90(jj) = mean(dum_D90(dum));
            zand(jj) = min(mean(dum_zand(dum)),100);
            datum(jj) = datenum(txt{(dum(1)-1)*17+2,3},'dd-mm-yy');
        end
        korrel_data.datum(i) = {datum};
        korrel_data.xRD(i) = {xRD};
        korrel_data.yRD(i) = {yRD};
        korrel_data.D10(i) = {D10};
        korrel_data.D50(i) = {D50};
        korrel_data.D90(i) = {D90};
        korrel_data.zand(i) = {zand};
    elseif i == 2        
        [num, txt]= xlsread(fullfile(korrel_dir,file.name),'sediment');
        for jj = 1:length(num(:,1))
            lat(jj) = str2num(txt{jj+2,8});
            lon(jj) = str2num(txt{jj+2,9});
            datum(jj) = datenum(txt{2+jj,2},'dd-mm-yy');        
        end
        [xRD,yRD] = convertCoordinates(lon,lat,'CS1.code',4326,'CS2.code',28992);
        D10 = 1e-3*num(:,11);
        D50 = 1e-3*num(:,13);
        D90 = 1e-3*num(:,12);
        zand = min([num(:,10) + num(:,15) + num(:,16) + num(:,26)],100);

        korrel_data.datum(i) = {datum};
        korrel_data.xRD(i) = {xRD};
        korrel_data.yRD(i) = {yRD};
        korrel_data.D10(i) = {D10};
        korrel_data.D50(i) = {D50};
        korrel_data.D90(i) = {D90};
        korrel_data.zand(i) = {zand};
    elseif i == 3        
        [num, txt]= xlsread(fullfile(korrel_dir,file.name),'coordinates');
        for jj = 1:length(num(:,1))
            datum(jj) = datenum(txt{1+jj,1},'dd-mm-yy');        
        end
        lat = num(:,4);
        lon = num(:,5);        
        [xRD,yRD] = convertCoordinates(lon,lat,'CS1.code',4326,'CS2.code',28992);
        
        clear num txt
        [num, txt]= xlsread(fullfile(korrel_dir,file.name),'sediment');                

        korrel_data.datum(i) = {datum};
        korrel_data.xRD(i) = {xRD};
        korrel_data.yRD(i) = {yRD};
        korrel_data.D10(i) = {1e-3*num(:,5)};
        korrel_data.D50(i) = {1e-3*num(:,7)};
        korrel_data.D90(i) = {1e-3*num(:,6)};
        korrel_data.zand(i) = {min([num(:,4) + num(:,9) + num(:,10) + num(:,20)],100)};
    end
end
%%%%%%%%%%%%%%%%%%%%%%%%%
xRD_2 = korrel_data.xRD{2};
yRD_2 = korrel_data.yRD{2};
D10_2 = korrel_data.D10{2};
D50_2 = korrel_data.D50{2};
D90_2 = korrel_data.D90{2};
zand_2 = korrel_data.zand{2};
datum_2 = korrel_data.datum{2};
%%%%%%%%%%%%%%%%%%%%%%%%%
xRD_3 = korrel_data.xRD{3};
yRD_3 = korrel_data.yRD{3};
D10_3 = korrel_data.D10{3};
D50_3 = korrel_data.D50{3};
D90_3 = korrel_data.D90{3};
zand_3 = korrel_data.zand{3};
datum_3 = korrel_data.datum{3};
%%%%%%%%%%%%%%%%%%%%%%%%%

figure
plot(korrel_data.xRD{1},korrel_data.yRD{1},'ko','MarkerFaceColor','k')
hold on
grid on
plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
axis equal
axis([0.550 0.562 3.974 3.986]*1e5)
xlabel('xRD (m)')
ylabel('yRD (m)') 
title('Locaties bodemmonsters genomen op 15/17 oktober 2007')
saveas(gcf,'PNG\locaties_2007-10.png')
saveas(gcf,'EPS\locaties_2007-10.eps','psc2')


% %%%%%%%%%%%%%%%%
% %%%%   D10   %%%
% %%%%%%%%%%%%%%%%
% figure
% plotclr([korrel_data.xRD{1},xRD_2(1:16)],[korrel_data.yRD{1},yRD_2(1:16)],...
%         [korrel_data.D10{1},D10_2(1:16)'],'ko',0.07,0.16)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(a) D_{10} (mm) zoals bepaald op 15/17 oktober 2007')
% saveas(gcf,'PNG\D10_2007-10.png')
% saveas(gcf,'EPS\D10_2007-10.eps','psc2')
%  
% figure
% plotclr(xRD_3(1:15),yRD_3(1:15),D10_3(1:15),'ko',0.07,0.16)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(b) D_{10} (mm) zoals bepaald op 4 juli 2008')
% saveas(gcf,'PNG\D10_2008-07.png')
% saveas(gcf,'EPS\D10_2008-07.eps','psc2')
%  
% figure
% plotclr([xRD_2(17:32),xRD_3(31:45)'],[yRD_2(17:32),yRD_3(31:45)'],...
%         [D10_2(17:32);D10_3(31:45)],'ko',0.07,0.16)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(c) D_{10} (mm) zoals bepaald op 15/20 oktober 2008')
% saveas(gcf,'PNG\D10_2008-10.png')
% saveas(gcf,'EPS\D10_2008-10.eps','psc2')
% 
% figure
% plotclr(xRD_3(46:60),yRD_3(46:60),D10_3(46:60),'ko',0.07,0.16)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(d) D_{10} (mm) zoals bepaald op 1 april 2009')
% saveas(gcf,'PNG\D10_2009-04.png')
% saveas(gcf,'EPS\D10_2009-04.eps','psc2')
% 
% figure
% plotclr(xRD_3(61:90),yRD_3(61:90),D10_3(61:90),'ko',0.07,0.16)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(e) D_{10} (mm) zoals bepaald op 14 juli 2009')
% saveas(gcf,'PNG\D10_2009-07.png')
% saveas(gcf,'EPS\D10_2009-07.eps','psc2')
% 
% %%%%%%%%%%%%%%%%
% %%%%   D50   %%%
% %%%%%%%%%%%%%%%%
% figure
% plotclr([korrel_data.xRD{1},xRD_2(1:16)],[korrel_data.yRD{1},yRD_2(1:16)],...
%         [korrel_data.D50{1},D50_2(1:16)'],'ko',0.12,0.24)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(a) D_{50} (mm) zoals bepaald op 15/17 oktober 2007')
% saveas(gcf,'PNG\D50_2007-10.png')
% saveas(gcf,'EPS\D50_2007-10.eps','psc2')
%  
% figure
% plotclr(xRD_3(1:15),yRD_3(1:15),D50_3(1:15),'ko',0.12,0.24)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(b) D_{50} (mm) zoals bepaald op 4 juli 2008')
% saveas(gcf,'PNG\D50_2008-07.png')
% saveas(gcf,'EPS\D50_2008-07.eps','psc2')
%  
% figure
% plotclr([xRD_2(17:32),xRD_3(31:45)'],[yRD_2(17:32),yRD_3(31:45)'],...
%         [D50_2(17:32);D50_3(31:45)],'ko',0.12,0.24)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(c) D_{50} (mm) zoals bepaald op 15/20 oktober 2008')
% saveas(gcf,'PNG\D50_2008-10.png')
% saveas(gcf,'EPS\D50_2008-10.eps','psc2')
% 
% figure
% plotclr(xRD_3(46:60),yRD_3(46:60),D50_3(46:60),'ko',0.12,0.24)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(d) D_{50} (mm) zoals bepaald op 1 april 2009')
% saveas(gcf,'PNG\D50_2009-04.png')
% saveas(gcf,'EPS\D50_2009-04.eps','psc2')
% 
% figure
% plotclr(xRD_3(61:90),yRD_3(61:90),D50_3(61:90),'ko',0.12,0.24)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(e) D_{50} (mm) zoals bepaald op 14 juli 2009')
% saveas(gcf,'PNG\D50_2009-07.png')
% saveas(gcf,'EPS\D50_2009-07.eps','psc2')
% 
% %%%%%%%%%%%%%%%%
% %%%%   D90   %%%
% %%%%%%%%%%%%%%%%
% figure
% plotclr([korrel_data.xRD{1},xRD_2(1:16)],[korrel_data.yRD{1},yRD_2(1:16)],...
%         [korrel_data.D90{1},D90_2(1:16)'],'ko',0.21,0.35)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(a) D_{90} (mm) zoals bepaald op 15/17 oktober 2007')
% saveas(gcf,'PNG\D90_2007-10.png')
% saveas(gcf,'EPS\D90_2007-10.eps','psc2')
%  
% figure
% plotclr(xRD_3(1:15),yRD_3(1:15),D90_3(1:15),'ko',0.21,0.35)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(b) D_{90} (mm) zoals bepaald op 4 juli 2008')
% saveas(gcf,'PNG\D90_2008-07.png')
% saveas(gcf,'EPS\D90_2008-07.eps','psc2')
%  
% figure
% plotclr([xRD_2(17:32),xRD_3(31:45)'],[yRD_2(17:32),yRD_3(31:45)'],...
%         [D90_2(17:32);D90_3(31:45)],'ko',0.21,0.35)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(c) D_{90} (mm) zoals bepaald op 15/20 oktober 2008')
% saveas(gcf,'PNG\D90_2008-10.png')
% saveas(gcf,'EPS\D90_2008-10.eps','psc2')
% 
% figure
% plotclr(xRD_3(46:60),yRD_3(46:60),D90_3(46:60),'ko',0.21,0.35)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(d) D_{90} (mm) zoals bepaald op 1 april 2009')
% saveas(gcf,'PNG\D90_2009-04.png')
% saveas(gcf,'EPS\D90_2009-04.eps','psc2')
% 
% figure
% plotclr(xRD_3(61:90),yRD_3(61:90),D90_3(61:90),'ko',0.21,0.35)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(e) D_{90} (mm) zoals bepaald op 14 july 2009')
% saveas(gcf,'PNG\D90_2009-07.png')
% saveas(gcf,'EPS\D90_2009-07.eps','psc2')
% 
% %%%%%%%%%%%%%%%%
% %%%%   Zand   %%%
% %%%%%%%%%%%%%%%%
% figure
% plotclr([korrel_data.xRD{1},xRD_2(1:16)],[korrel_data.yRD{1},yRD_2(1:16)],...
%         [korrel_data.zand{1},zand_2(1:16)'],'ko',85,100)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(a) % zand (D_{50} > 0.063 mm) zoals bepaald op 15/17 oktober 2007')
% saveas(gcf,'PNG\zand_2007-10.png')
% saveas(gcf,'EPS\zand_2007-10.eps','psc2')
%  
% figure
% plotclr(xRD_3(1:15),yRD_3(1:15),zand_3(1:15),'ko',85,100)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(b) % zand (D_{50} > 0.063 mm) zoals bepaald op 4 juli 2008')
% saveas(gcf,'PNG\zand_2008-07.png')
% saveas(gcf,'EPS\zand_2008-07.eps','psc2')
%  
% figure
% plotclr([xRD_2(17:32),xRD_3(31:45)'],[yRD_2(17:32),yRD_3(31:45)'],...
%         [zand_2(17:32);zand_3(31:45)],'ko',85,100)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(c) % zand (D_{50} > 0.063 mm) zoals bepaald op 15/20 oktober 2008')
% saveas(gcf,'PNG\zand_2008-10.png')
% saveas(gcf,'EPS\zand_2008-10.eps','psc2')
% 
% figure
% plotclr(xRD_3(46:60),yRD_3(46:60),zand_3(46:60),'ko',85,100)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(d) % zand (D_{50} > 0.063 mm) zoals bepaald op 1 april 2009')
% saveas(gcf,'PNG\zand_2009-04.png')
% saveas(gcf,'EPS\zand_2009-04.eps','psc2')
% 
% figure
% plotclr(xRD_3(61:90),yRD_3(61:90),zand_3(61:90),'ko',85,100)
% hold on
% plot(cb_data.x,cb_data.y,'k-','LineWidth',1.0)
% axis equal
% axis([0.550 0.562 3.974 3.986]*1e5)
% xlabel('xRD (m)')
% ylabel('yRD (m)') 
% title('(e) % zand (D_{50} > 0.063 mm) zoals bepaald op 14 july 2009')
% saveas(gcf,'PNG\zand_2009-07.png')
% saveas(gcf,'EPS\zand_2009-07.eps','psc2')