function Params = GetGliderParams(s)
% Returns a char array of length sdn with the parameters included in the
% glider mission. Logic is: check if the data field exists in the struct if
% it does then check that it contains data. If no data or no struct then
% the field name is blank in Params. If data then fieldname is contained in
% Params.
% Ben Werb 6/4/24



if isfield(s, 'pres')
    presValue = s.pres;
    if sum(abs(presValue), 'all', 'omitnan') >= 1
        pres = 'pres ';
    else
        pres = '';
    end
else
    pres = '';
end

if isfield(s, 'tc')
    tcValue = s.tc;
    if sum(abs(tcValue), 'all', 'omitnan') >= 1
        temp = 'temp ';
    else
        temp = '';
    end
else
    temp = '';
end

if isfield(s, 'psal')
    psalValue = s.psal;
    if sum(abs(psalValue), 'all', 'omitnan') >= 1
        sal = 'sal ';
    else
        sal = '';
    end
else
    sal = '';
end

if isfield(s, 'doxy')
    doxyValue = s.doxy;
    if sum(abs(doxyValue), 'all', 'omitnan') >= 1
        doxy = 'doxy ';
    else
        doxy = '';
    end
else
    doxy = '';
end

if isfield(s, 'pH25atm')
    pH25atmValue = s.pH25atm;
    if sum(abs(pH25atmValue), 'all', 'omitnan') >= 1
        pH25atm = 'pH25atm ';
    else
        pH25atm = '';
    end
else
    pH25atm = '';
end

if isfield(s, 'PAR')
    parValue = s.PAR;
    if sum(abs(parValue), 'all', 'omitnan') >= 1 &&...
            mean(parValue, 'all', 'omitnan') ~= 4.160399999999963e+03
            % Default value when no sensor attached
        PAR = 'PAR ';
    else
        PAR = '';
    end
else
    PAR = '';
end

if isfield(s, 'opt')
    optValue = s.opt;
    if sum(abs(optValue), 'all', 'omitnan') >= 1
        Chl = 'Chl ';
    else
        Chl = '';
    end
else
    Chl = '';
end


Params = string(repmat([pres temp sal doxy pH25atm PAR Chl],length(s.sdn),1)); % size change messes up the table

end