% screwed up
clear all
load(['AllVbeachsurveys.mat'])
idate=37
%%
figure(666)
hold off
plot(Vsurvey(idate,1).paths.combinedpath_rot(:,3),'r')
hold all; 
plot(Vsurvey(idate,1).paths.combinedpath(:,3))
dl=length(Vsurvey(idate,1).paths.combinedpath(:,3))-length(Vsurvey(idate,1).paths.combinedpath_rot(:,3))

Vsurvey(idate,1).paths.combinedpath_test(:,3)=Vsurvey(idate,1).paths.combinedpath(:,3);

%%

dz=Vsurvey(idate,1).paths.combinedpath_test(1:length(Vsurvey(idate,1).paths.combinedpath_rot(:,3)),3)-Vsurvey(idate,1).paths.combinedpath_rot(1:length(Vsurvey(idate,1).paths.combinedpath_rot(:,3)),3);
ind=find (dz~=0);
ind(1)


%%
Vsurveybadpoints_new(5,1).indexes=[11164];
Vsurveybadpoints_new(6,1).indexes=[11786 12764 13415 13758 13991];
Vsurveybadpoints_new(8,1).indexes=[7851 7853+1 7857+2 7861+3 7941+4 8352+5 8561+6 8880+7 8890+8 9017+9 9066+10 9313+11 9338+12 9338+13 9338+14 9344+15 9431+16 9607+17 9622+18 9623+19 9627+20 9693+21 9775+22 9981+23 10169+24 10170+25 10184+26 10185+27 10465+28 10517+29 10567+30];
Vsurveybadpoints_new(13,1).indexes=[9079 9428+1 9440+2 9523+3 11900+4 11944+5 12311+6 12315+7 12769+8 13054+9 13060+10 13154+11];
Vsurveybadpoints_new(15,1).indexes=[10909 12984+1 13919+2 14253+3];
Vsurveybadpoints_new(17,1).indexes=[11274 11280+1];
Vsurveybadpoints_new(20,1).indexes=[3635+[0:28 30:255] 4766+254+[1:144]];
Vsurveybadpoints_new(25,1).indexes=[13643 15917+1];
Vsurveybadpoints_new(28,1).indexes=[8852 9398+1 11139+2];
Vsurveybadpoints_new(29,1).indexes=[21620 21621];
Vsurveybadpoints_new(31,1).indexes=[16391];
Vsurveybadpoints_new(36,1).indexes=[14093];
Vsurveybadpoints_new(37,1).indexes=[];

Vsurvey(idate,1).paths.combinedpath_test=Vsurvey(idate,1).paths.combinedpath;
Vsurvey(idate,1).paths.combinedpath_test(Vsurveybadpoints_new(idate,1).indexes,:)=[];
%%
figure(1111)
hold off
%plot(Vsurvey(idate,1).paths.combinedpath(:,3),'color',0.5*[1 1 1])
plot(Vsurvey(idate,1).paths.combinedpath_rot(:,3),'r')
hold all; 
plot(Vsurvey(idate,1).paths.combinedpath_test(:,3),':k')
dz=Vsurvey(idate,1).paths.combinedpath_test(:,3)-Vsurvey(idate,1).paths.combinedpath_rot(:,3);
max(dz)