function [t,dat,name,units] = read_tsd(file)
% Reads an SMS Time Series Data file (*.tsd)
%
%   [t,dat,name,units] = read_tsd(file)
%
% written by Alex Sanchez, USACE-CHL
fid = fopen(file,'r');
fgets(fid); %Skip header line
str = fgets(fid);
ind = findstr(str,'"');
name = str(ind(1)+1:ind(2)-1);
units = str(ind(3)+1:ind(4)-1);
sdate = str(ind(5)+1:ind(6)-1);
ncolrow = str2num(str(ind(4)+1:ind(5)-1));
tstart = datenum(sdate);
data = fscanf(fid,'%f %f',ncolrow)';
fclose(fid);
t = datenum(data(:,1)/86400+tstart);
dat = data(:,2:end);
return