function [Transect]=GrabTransect_sierd(XYZ,TransectNo)

% function to extract data along the predefined transect lines (1 - 22)
% 
% first read in the bathy from text file
% like: XYZ=read_XYZ (when in the produucts folder of the desired survey)
% 
% then extract transect by f.i. TransectAug=GrabTransect(XYZ,12);



%%% read transect coordinates 
load surveylines.mat

%% 
Transect.No=TransectNo
Transect.xi=Surveylines{TransectNo,1}.xi;
Transect.yi=Surveylines{TransectNo,1}.yi;
% Transect.Surveydate=XYZ.Surveydate

%% Interpolate survey points onto grid  ( To be replaced later with a fancy kriging / loess interpolation method)
% gridsize=5;
[XI,YI] = meshgrid(Transect.xi, Transect.yi);
 ZI = griddata(XYZ(:,1),XYZ(:,2),XYZ(:,3),XI,YI);

%% Extract Transect from Bathy
Transect.zi = interp2(XI,YI,ZI,Transect.xi,Transect.yi)
Transect.x_acc_i=[-200:10:1250];  %%% Watch out... should be the same as in the file that created the surveylines.


%% Plot
 figure(6)
plot(Transect.x_acc_i,Transect.zi,'k')

title('Transect')


