function [time,position,temp,depth]=udasread(file);
%
% [time,position,temp,depth]=udasread(file);
%

% 12/28/10 - Chris Miller

%R/V John H. Martin Underway Data Acquisition System Data File
%Column 1:  YYYYMMDD
%Column 2:  HHMMSS
%Column 3:  Decimal Julian Day
%Column 4:  Decimal Hour
%Column 5:  Latitude
%Column 6:  Longitude
%Column 7: Salinity PSS78 from SBE45: S/N 4529602-0057  
%Column 8: Temperature in degrees C fromSBE45  
%Column 9:  Conductivity in S/m from SBE45
%Column 10: Raw Fluorescence from Scufa: S/N 
%Column 11: Turbidity from Scufa
%Column 12: Temperature in degrees C from Scufa
%Column 13: GMT
%Column 14: Depth
fid=fopen(fname);
frewind(fid)
tline=fgetl(fid);
while numel(tline)>0,    % Skip over header information
    tline=fgetl(fid);
end;
while numel(tline)==0,    % Skip over blank line(s) between header & data
    tline=fgetl(fid);
end;
%%  Read in data
i=1;
% NOTE: UDAS data has a 10 second difference between local & GMT time,
% unknown which is 'more correct'.  Using local time seconds in return value
tline2=sscanf(tline,'%4d%2d%2d %2d%2d%2d %f %f %s %s %f %f %f %f %f %f %d:%d:%d %f');
date(i)=datenum(tline2(1),tline2(2),tline2(3),tline2(34),tline2(5),tline2(6));
position(i,:)=[str2num(char(tline2(9:10).'))+str2num(char(tline2(12:17).'))/60 ...
    -str2num(char(tline2(18:20).'))-str2num(char(tline2(22:27).'))/60];
SST(i)=tline2(33);
Depth(i)=tline2(37);

while ~feof(fid),   % Do until end of file is reached
    i=i+1;
    tline=fgetl(fid);
    tline2=sscanf(tline,'%4d%2d%2d %2d%2d%2d %f %f %s %s %f %f %f %f %f %f %d:%d:%d %f');
    date(i)=datenum(tline2(1),tline2(2),tline2(3),tline2(34),tline2(5),tline2(6));
    position(i,:)=[str2num(char(tline2(9:10).'))+str2num(char(tline2(12:17).'))/60 ...
        -str2num(char(tline2(18:20).'))-str2num(char(tline2(22:27).'))/60];
    SST(i)=tline2(33);
    Depth(i)=tline2(37);
    dline=fgetl(fid);         % read in next line of data
end;
fclose(fid);