function [tmod,smod,cmod]=syncruise(cdf,x,y,z,jd);
%function [tmod,smod,cmod]=syncruise(cdf,x,y,z,jd);
%
% cdf = ecomsi.cdf file to extract data out of along cruise track
% x = x location of profiles in km
% y = y location of profiles in km
% z = vector of profile depths

 jdmod=ecomtime2(cdf);
% we need the x and y locations of the model grid
 [depth,xmod,ymod]=kslice(cdf,'depth');
 iwet=find(~isnan(depth));

 xmod=xmod/1000;  % convert to km
 ymod=ymod/1000;

 nsta=length(x);
 z=-abs(z);
 smod=ones(length(z),length(x))*nan;
 tmod=smod;
 cmod=smod;
 for i=1:nsta
   ind=nearxy(xmod(iwet),ymod(iwet),x(i),y(i));
   ind=iwet(ind);
   [imod,jmod]=ind2ij(xmod,ind);
   ti=tind(jdmod,gregorian(jd(i)));
   [st,jdt,zmod]=ecomts(cdf,'salt',imod,jmod,nan,ti);
   ii=find(z>min(zmod)&z<max(zmod));
   smod(ii,i)=interp(zmod,st,z(ii));
   [tt,jdt,zmod]=ecomts(cdf,'temp',imod,jmod,nan,ti);
   tmod(ii,i)=interp(zmod,tt,z(ii));
   [cc,jdt,zmod]=ecomts(cdf,'conc',imod,jmod,nan,ti);
   cmod(ii,i)=interp(zmod,cc,z(ii));
  end
