function pH_insitu = spec_pH_insitu(SpecpHData)
%SPEC_PH_INSITU calculates insitu pH using CO2SYS function. QC is a
%logical array that selects non junk measurements.

trex = CO2SYS(2270, SpecpHData.pH_tot,...
    1, 3, SpecpHData.Salinity,...
    20, SpecpHData.Temp_samp, 0, 0, 0, 0, 1, 10, 1); %
pH_insitu = trex(:,18); % Grab insitu pH
end

