
function ctd = load_M1_CTD(buoy,dep)

%read cumulative file (don't bother reading daily file(s))
 data = read_M1_CTD_full(buoy,dep);

%get rid of nonsense time values
 f = find( data(:,1)<datenum([1900 1 0]) | ...
   data(:,1)>now +30 ); %arbitrary 30 d from now
 data(f,:)=[];
 clear f;

%take unique time values only
 [~,i]=unique(data(:,1));
 data=data(i,:);
 clear i;

%sort by time (may not be nec)
 [~,i]=sort(data(:,1));
 data=data(i,:);
 clear i;

%assign to structure
 %data
  ctd.time = data(:,1);
  ctd.temp = data(:,2);
  ctd.cond = data(:,3);
 %sal
  ctd.sal=calcSal(ctd.cond,ctd.temp,0);
 %sigma-t
  [~,ctd.sigt]=swstate(ctd.sal,ctd.temp,0);
 clear data;
