%%  load survey data
% locate vlugtenburg directory on this computer
curdir=pwd;
ind_v=findstr(curdir, 'vlugtenburg');
pathvlugtenburg=[(curdir(1:ind_v+10)) '\'];  % gives back cometing like F:\check_outs\tudelft\vlugtenburg\
NetCDFfilename=[pathvlugtenburg 'vlugtenburg.nc'];
%nc_dump(NetCDFfilename);  % give a quick overview of the contents

dates=nc_varget(NetCDFfilename,'time');     % survey dates
survey_ind=list_surveys;                    % list with the surveys and the survey pairs

% indjet=survey_ind.indjet; indwalk=survey_ind.indwalk; 
pairs=survey_ind.Survey_pairs;  % rewrite to local variables... bit easier later on

paths=nc_varget(NetCDFfilename,'survey_path');
Vsurvey=struct;

disp('extracting NetCDF...')
for idate=1:length(pairs)
Vsurvey(idate,1).date=dates(idate,:);
Vsurvey(idate,1).matlabdate=datenum(dates(idate,:),'mm/dd/yyyy');
altwalkraw=squeeze(paths(pairs(idate,1),:,:));
Vsurvey(idate,1).paths.altwalk=altwalkraw(~isnan(altwalkraw(:,3)),:);
altjetraw=squeeze(paths(pairs(idate,2),:,:));
Vsurvey(idate,1).paths.altjet=altjetraw(~isnan(altjetraw(:,3)),:);
Vsurvey(idate,1).paths.combinedpath=[Vsurvey(idate,1).paths.altwalk ; Vsurvey(idate,1).paths.altjet];
x=nc_varget(NetCDFfilename,'cross_shore');
Vsurvey(idate,1).transects.y=nc_varget(NetCDFfilename,'dist_alongshore');
Vsurvey(idate,1).transects.tr_nr=nc_varget(NetCDFfilename,'alongshore');
end

disp('done')

%% example survey
if 0
    idate=5;
    figure
    scatter3(Vsurvey( idate,1).paths.combinedpath(:,1),Vsurvey( idate,1).paths.combinedpath(:,2),Vsurvey( idate,1).paths.combinedpath(:,3),5,Vsurvey( idate,1).paths.combinedpath(:,3) )
end
