%% Get the names of all files in the directory
folder = 'C:\Users\bwerb\Documents\thoon_ww\ncfiles';
fileList = dir(folder);
fileNames = {fileList.name};
fileNames = fileNames(~ismember(fileNames, {'.', '..'}));

% Loop through to get the k0 for each nc file
n = length(fileNames);
for i = 1:n


file = 'THWW01-d01_2024-06-02_telemetered.nc';

[ww] = readncTHOON(file,0); % read nc file

[ww] = THOONK0Calc(ww); % recalculate k0 with CanyonB estimated pH

[ww] = THOONpH_adj(ww); % recalculate pH with adjusted k0 value

filename = char(file);
filename = filename(1:end-3);
if save==1
    save([filename,'.mat'], 'ww'); % Save the struct as a .mat file
end
end