function [seabassParm, units] = oms_getSeabassFieldname(S, flag)
% oms_getSeabassFieldname - Returns seabass style field names from an info structure
%
% Use as: N = oms_getSeabassFieldname(S, flag)
%
% Inputs: S = structure returned from oms_getinfo
%         flag = Switch. 1 = add wavelength to seabass names [default] (where appropriate)
%                        0 = Don't add wavelengths to names
%
% Output: N = cell array of seabass style names
%         U = cell array of seabass style units

% Brian Schlining
% 22 Aug 2000

seabassParm = cell(size(S.symbol));
units = cell(size(S.units));

if nargin < 2
   flag = 1;
end


for i = 1:length(S.name)
   depth = S.instrumentDepth(i);
   tmp = [];
   ut = [];
   switch S.symbol{i}
   case 'ed'
      tmp = 'Ed'
      if flag
         tmp = [tmp num2str(S.wavelength(i))];
      end
      ut  = 'uW/cm^2/nm';
   case 'lu'
      tmp = 'Lu';
      if flag
         tmp = [tmp num2str(S.wavelength(i))];
      end
      ut  = 'uW/cm^2/nm/sr';
   case 'es'
      tmp = 'Es';
      if flag
         tmp = [tmp num2str(S.wavelength(i))];
      end
      ut  = 'uW/cm^2/nm';
   case 'par'
      ut  = 'uE/sm^2/s';
      if depth >= 0
         tmp = 'EPar';
      else
         tmp = 'PAR';
      end
   case 't'
      ut = 'degreesC';
      if depth >= 2
         tmp = 'Wt';
      elseif depth <= 0
         tmp = 'At';
      else
         tmp = 'SST';
      end
      
   case 'z'
      
      if depth >= 0
         tmp = 'pressure';
         ut = 'dbar';
      else
         tmp = 'altitude';
         ut = 'm';
      end
      
   case 'lw'
      tmp = 'Lw';
      if flag
         tmp = [tmp num2str(S.wavelength(i))];
      end
      ut = 'uW/cm^2/nm/sr';
      
   case 'lwn'
      tmp = 'Lwn';
      if flag
         tmp = [tmp num2str(S.wavelength(i))];
      end
      ut = 'uW/cm^2/nm/sr';
      
   case 'rrs'
      tmp = 'Rrs';
      if flag
         tmp = [tmp num2str(S.wavelength(i))];
      end
      ut = '1/sr';
      
   end
   seabassParm{i} = tmp;
   units{i} = ut;
end

