function oxy = read_oxy(in_file)
% READ_OXY - load *.oxy files from the AOML Winkler titration system. 
%
% USAGE:
%  oxy = read_oxy(filename);
%
% INPUT:
%     in_file: string containing path and name of input file
%
% OUTPUT:
%   oxy: struct with fields
%     station: string indicating station/cast
%     depth: depth field in the titration computer, frequently Niskin
%			bottle Rosette position
%     sample_bottle: label of the sample bottle in which the titration
% 			was done.
%     thio_vol: solume of Thiosulphate in the titration.
%     oxygen: oxygen in units of micromoles per liter.  See ox_units
%  			for conversion to other
%       more standard units for analysis. 
%     units: 'mmmperl'
%
% DESCRIPTION:
%
% BUGS:
% 
% NOTE:
%
% TO BE DONE:
%   
%  CALLER: 
%
%  DEPENDENCIES: 
%

% AUTHOR: Jay Hoooper 2/19/2011
%         NOAA/AOML/PhOD
%
% 
%


%Read in file 
% [m,d,y,hr,min,station,depth,samp_bot,thio,ox]= ...
%    textread(in_file,'%d/%d/%d %d:%d %d %f %d %f %f','headerlines',9);
%%%%%%%%% CMDR read and parse station as a [:alnum:] string
[statstr,niskin,samp_bot,draw_Tmp,oxmml,oxmmkg,thio_v]= ...
   textread(in_file,'%s %*d %d %d %f %*f %*f %f %f %*f %f %*f','headerlines',1);
%% the station number is often like FS01, where we want an integer. So
%% we treat this simple case by throwing out all alpha characters
station=zeros(length(statstr),1);
for i=1:length(statstr),
	station(i)=str2num(regexprep(statstr{i},'[a-zA-Z]',''));
end;

%dat = datenum(y,m,d,hr,min,0);
oxy = struct('cruiseid',[],'station',station,'niskin',niskin,...
    'sample_bottle',samp_bot,'draw_T',draw_Tmp,'thio_vol',thio_v,'oxy_mml',oxmml,'oxygen',oxmmkg,'units','mmkg');
% ox is in units of micromole per liter
return;


