gdata = readtable("Diel_GPP_log.csv");
i = 4;



fig1 = figure('Visible','on');
    tl = tiledlayout(3,1);
    title(tl,['Glider Mission ID: ', num2str(gdata.MissionID(i))])
    subtitle(tl,{['pH Diel Cycle ', char(gdata.StartDate(i)), ' to ', char(gdata.EndDate(i))],...
        ['Mean Layer: ', num2str(abs(s.depth(iupper(1)))), ' m - ', num2str(abs(s.depth(iupper(end)))), ' m']})
    ylabel(tl, 'pH 25C')
    nexttile
    plot(sdn,pH,'.')
    datetick('x',6,'keeplimits')
    xlabel('date')
    title('pH full time series')
    
    nexttile
    plot(0:23,diel,'.')
    legend(LegendNames,Location='eastoutside')
    xlabel('Local Time hrs')
    xticks([0 6 12 18 23])
    xticklabels({'00:00', '6:00', '12:00', '18:00', '00:00'});
    xlim([0 23])
    title('diel cycle by day')
    hold on
    plot(0:23,mean(diel,1,"omitmissing"),MarkerSize=12)
    
    nexttile
    plot(0:23,mean(diel,1,"omitmissing"),'-.')
    hold on
    % add errorbars
    yyaxis right
    plot(0:23,range(diel,1),'-.')
    xlabel('Local Time hrs')
    title('Diel Cycle Calculations')
    xlim([0 23])
    xticks([0 6 12 18 23])
    xticklabels({'00:00', '6:00', '12:00', '18:00', '00:00'});