clear all
close all

OPT.dir  =  'H:\PhD\Fieldwork\Fieldwork2010\'; %'';
OPT.plot = 0;
%% Import data
[xx1, coo1] = xlsread([OPT.dir,'Locations and measurements 2010.xls'],'surfsedfornc','B8:C45');
sed1        = xlsread([OPT.dir,'Locations and measurements 2010.xls'],'surfsedfornc','E8:H45');

[xx2, coo2] = xlsread([OPT.dir,'Locations and measurements 2010.xls'],'30cmsedfornc','B8:C45');
sed2        = xlsread([OPT.dir,'Locations and measurements 2010.xls'],'30cmsedfornc','E8:H45');
%% Bewerk coordinaten voor surf sed
l         = size(coo1);
for i       = 1:l(1);
    latdms1(i,1)= coo1(i,1);
    londms1(i,1)= coo1(i,2);
end
xx=cell2mat(latdms1(:,1));
yy=cell2mat(londms1(:,1));
for  i       = 1:l(1);
     Dxx(i,1)=str2num(xx(i,1:3));
     Mxx(i,1)=str2num(xx(i,5:6));
     Sxx(i,1)=str2num(xx(i,8:11));
     Dyy(i,1)=str2num(yy(i,1:2));
     Myy(i,1)=str2num(yy(i,4:6));
     Syy(i,1)=str2num(yy(i,7:10));
end
xcoo1=[Dxx Mxx Sxx];
ycoo1=[Dyy Myy Syy];
for i = 1:l(1)
    lon1(i,1) = dms2degrees(xcoo1(i,:));
    lat1(i,1) = dms2degrees(ycoo1(i,:));
end
%% Bewerk coordinaten voor 30 cm deep sed
l         = size(coo2);
for i       = 1:l(1);
    latdms2(i,1)= coo2(i,1);
    londms2(i,1)= coo2(i,2);
end
xx=cell2mat(latdms2(:,1));
yy=cell2mat(londms2(:,1));
for  i       = 1:l(1);
     Dxx(i,1)=str2num(xx(i,1:3));
     Mxx(i,1)=str2num(xx(i,5:6));
     Sxx(i,1)=str2num(xx(i,8:11));
     Dyy(i,1)=str2num(yy(i,1:2));
     Myy(i,1)=str2num(yy(i,4:6));
     Syy(i,1)=str2num(yy(i,7:10));
end
xcoo2=[Dxx Mxx Sxx];
ycoo2=[Dyy Myy Syy];
for i = 1:l(1)
    lon2(i,1) = dms2degrees(xcoo2(i,:));
    lat2(i,1) = dms2degrees(ycoo2(i,:));
end

%% sa si cl percentages bepalen
% sed kolom 1 = sample depth
% sed kolom 2 = D50 micrometer
% sed kolom 3 = vol % sand
% sed kolom 4 = vol % silt
% sed kolom 5 = vol % clay
sa1=sed1(:,2); sa2=sed2(:,2);
si1=sed1(:,3); si2=sed2(:,3);
cl1=sed1(:,4); cl2=sed2(:,4);
%% save
save([OPT.dir,'2010surfsed.mat'],'lat1','lon1','sa1','si1','cl1')
save([OPT.dir,'2010deep30cmsed.mat'],'lat2','lon2','sa2','si2','cl2')
if OPT.plot

%% data plotten
lat1=min(ycoo1(:,1));lat2=max(ycoo1(:,1));
lon1=min(xcoo1(:,1));lon2=max(xcoo1(:,1));

%% Plot all data
figure(1)
%worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
%worldmap([(lat2-0.03) (lat2+0.03)],[(lon2-0.03) (lon2+0.03)]);
worldmap([(lat1-0.03) (lat1+0.03)],[(lon1-0.03) (lon1+0.03)]);
scatterm(yco1,xco1,35,si,'filled'); hold on;
%colormap('cool'); 
caxis([0 100]);
colorbar;
title('Siltmap all nov 2010')
set(gcf,'Units','centimeters')
set(gcf,'Position',[0 0 18 18])
set(gcf,'PaperPositionMode','auto')
print('-dpng','-r300',[OPT.dir,'Siltmap all nov 2010.png'])

figure(2)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(yco,xco,35,sa,'filled'); hold on;
%load('clc_100','clc_100')
%set(gcf,'colormap',clc_100)
caxis([0 100]);
colorbar;
title('Sandmap all nov 2010')
set(gcf,'Units','centimeters')
set(gcf,'Position',[0 0 18 18])
set(gcf,'PaperPositionMode','auto')
print('-dpng','-r300',[OPT.dir,'Sandmap all nov 2010.png'])

figure(3)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(yco,xco,35,cl,'filled'); hold on;
caxis([0 100]);
colorbar;
title('Claymap all nov 2010')
set(gcf,'Units','centimeters')
set(gcf,'Position',[0 0 18 18])
set(gcf,'PaperPositionMode','auto')
print('-dpng','-r300',[OPT.dir,'Claymap all nov 2010.png'])

close all
%% Plot surface data
a            = find(sed(:,1)==30);
sitop=si;
sitop(a,:)     = [];
satop=sa;
satop(a,:)     = [];
cltop=cl;
cltop(a,:)     = [];
xcotop=xco;
xcotop(a,:)     = [];
ycotop=yco;
ycotop(a,:)     = [];

figure(1)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycotop,xcotop,35,sitop,'filled'); hold on;
%colormap('cool'); 
caxis([0 100]);
colorbar;
title('Siltmap topsed nov 2010')
set(gcf,'Units','centimeters')
set(gcf,'Position',[0 0 18 18])
set(gcf,'PaperPositionMode','auto')
print('-dpng','-r300',['Siltmap topsed nov 2010.png'])

figure(2)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycotop,xcotop,35,satop,'filled'); hold on;
%colormap('cool'); 
caxis([0 100]);
colorbar;
title('Sandmap topsed nov 2010')
set(gcf,'Units','centimeters')
set(gcf,'Position',[0 0 18 18])
set(gcf,'PaperPositionMode','auto')
print('-dpng','-r300',['Sandmap topsed nov 2010.png'])

figure(3)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycotop,xcotop,35,cltop,'filled'); hold on;
%colormap('cool'); 
caxis([0 100]);
colorbar;
title('Claymap topsed nov 2010')
set(gcf,'Units','centimeters')
set(gcf,'Position',[0 0 18 18])
set(gcf,'PaperPositionMode','auto')
print('-dpng','-r300',['Claymap topsed nov 2010.png'])

close all

%% Plot bottom data
a            = find(sed(:,1)==0);
sideep=si;
sideep(a,:)     = [];
sadeep=sa;
sadeep(a,:)     = [];
cldeep=cl;
cldeep(a,:)     = [];
xcodeep=xco;
xcodeep(a,:)     = [];
ycodeep=yco;
ycodeep(a,:)     = [];

figure(1)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycodeep,xcodeep,35,sideep,'filled'); hold on;
%colormap('cool'); 
caxis([0 100]);
colorbar;
title('Siltmap deepsed nov 2010')
set(gcf,'Units','centimeters')
set(gcf,'Position',[0 0 18 18])
set(gcf,'PaperPositionMode','auto')
print('-dpng','-r300',['Siltmap deepsed nov 2010.png'])

figure(2)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycodeep,xcodeep,35,sadeep,'filled'); hold on;
%colormap('cool'); 
caxis([0 100]);
colorbar;
title('Sandmap deepsed nov 2010')
set(gcf,'Units','centimeters')
set(gcf,'Position',[0 0 18 18])
set(gcf,'PaperPositionMode','auto')
print('-dpng','-r300',['Sandmap deepsed nov 2010.png'])

figure(3)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycodeep,xcodeep,35,cldeep,'filled'); hold on;
%colormap('cool'); 
caxis([0 100]);
colorbar;
title('Claymap deepsed nov 2010')
set(gcf,'Units','centimeters')
set(gcf,'Position',[0 0 18 18])
set(gcf,'PaperPositionMode','auto')
print('-dpng','-r300',['Claymap deepsed nov 2010.png'])

close all


%% Plot all data in one figure
figure
subplot(3,3,2)
title('Siltmap all nov 2010')
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(yco,xco,35,si,'filled'); hold on;
caxis([0 100]);
colorbar;

subplot(3,3,1)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(yco,xco,35,sa,'filled'); hold on;
caxis([0 100]);
colorbar;
title('Sandmap all nov 2010')

subplot(3,3,3)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(yco,xco,35,cl,'filled'); hold on;
caxis([0 100]);
colorbar;
title('Claymap all nov 2010')

%% Plot surface data in one figure
a            = find(sed(:,1)==30);
sitop=si;
sitop(a,:)     = [];
satop=sa;
satop(a,:)     = [];
cltop=cl;
cltop(a,:)     = [];
xcotop=xco;
xcotop(a,:)     = [];
ycotop=yco;
ycotop(a,:)     = [];

subplot(3,3,5)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycotop,xcotop,35,sitop,'filled'); hold on;
caxis([0 100]);
colorbar;
title('Siltmap topsed nov 2010')

subplot(3,3,4)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycotop,xcotop,35,satop,'filled'); hold on;
caxis([0 100]);
colorbar;
title('Sandmap topsed nov 2010')

subplot(3,3,6)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycotop,xcotop,35,cltop,'filled'); hold on;
caxis([0 100]);
colorbar;
title('Claymap topsed nov 2010')
%% Plot bottom data in one figure
a            = find(sed(:,1)==0);
sideep=si;
sideep(a,:)     = [];
sadeep=sa;
sadeep(a,:)     = [];
cldeep=cl;
cldeep(a,:)     = [];
xcodeep=xco;
xcodeep(a,:)     = [];
ycodeep=yco;
ycodeep(a,:)     = [];

subplot(3,3,8)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycodeep,xcodeep,35,sideep,'filled'); hold on;
caxis([0 100]);
colorbar;
title('Siltmap deepsed nov 2010')

subplot(3,3,7)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycodeep,xcodeep,35,sadeep,'filled'); hold on;
caxis([0 100]);
colorbar;
title('Sandmap deepsed nov 2010')

subplot(3,3,9)
worldmap([(lat1-0.03) (lat2+0.04)],[(lon1-0.05) (lon2+0.05)]);
scatterm(ycodeep,xcodeep,35,cldeep,'filled'); hold on;
caxis([0 100]);
colorbar;
title('Claymap deepsed nov 2010')
set(gcf,'Units','centimeters')
set(gcf,'Position',[0 0 45 45])
set(gcf,'PaperPositionMode','auto')
print('-dpng','-r300',[OPT.dir,'Sasiclmap top and deep nov 2010.png'])

close all
%}

end % OPT.plot