function oxy_conc=oxy_calc_none(volt,salt,temp,press,Soc,Voffset,Boc,tcor,pcor)
%OXY_CALC_NONE - calculate the oxygen concentration from the sensor voltage
%		and the calibration constants.	
% 
%USAGE -	oxy_conc=oxy_calc_none(volt,salt,temp,press, ...
%				Soc,Voffset,Boc,tcor,pcor); 
%
%		if the calibration constants are provided, use them, otherwise
%		use some default nominal values
%
%EXPLANATION -	based on oxy_fit_none (CTDCAL toolbox). The function is set up
%		'recursively' - if a cell variable is passed, then call the 
% 		function for each element of the cell; if a matrix is passed, 
%		do the calculation.
%
%SEE ALSO -	oxy_fit_none
%

%PROGRAM - 	MATLAB code by c.m.duncombe rae
%
%CREATED -	2007/12/30
% 
%VERSION - 
%	$Revision: 1.6 $
%	$Date: 2008/03/21 23:26:54 $
%	$Id: oxy_calc_none.m,v 1.6 2008/03/21 23:26:54 duncombe Exp duncombe $
%
%CHANGE_LOG -
%  2008/01/09 CMDR
%	* use nominal sensor constants if they are not provided in the call
%  2008/01/11 CMDR
%	* use the oxygen saturation function from the seawater toolbox
%
%DISCLAIMER -	No responsibility can be accepted for failure or 
%		incorrect operation of this code. No guarantee, express 
%		or implied, is given. 
%

% We might want to check that the input variables have the correct
% form and shape. 
% set up some default values for the calibration if we are not given any
if ~exist('tcor'), tcor=0.0022; end;	    %nominal value - 07/25/05 sensor 
if ~exist('pcor'), pcor=1.350e-4; end;      %nominal value - 07/25/05 sensor
if ~exist('Boc'), Boc=0.0; end;		    %nominal value - 07/25/05 sensor 
if ~exist('Soc'), Soc=0.4088; end;	    %nominal value - 07/25/05 sensor 
if ~exist('Voffset'), Voffset=-0.4844; end; %nominal value - 07/25/05 sensor
%
% if isstruct(volt), 
if iscell(volt),
   for i = 1:length(volt),
      oxy_conc{i}=oxy_calc_none( ...
	volt{i},salt{i},temp{i},press{i},Soc,Voffset,Boc,tcor,pcor);
   end;
else
	% sea-bird application note 64-2 says that Boc is set always to 0
   oxy_conc = ((Soc.*(volt+Voffset)) +  ...
		Boc.*exp(-0.03.*temp)).*exp(tcor.*temp) .*  ...
		sw_satO2(temp,salt).*exp(pcor.*press);
end;

return;

