ctd = readtable('\\atlas.shore.mbari.org\ChemWebData\termserv\testtank\microcat\sbe37.log'); % CTD
vars = {'temp','cond','pres','sal','density','dow','ddmmmyyyy','HHMMSS'};
ctd.Properties.VariableNames = vars;
ctd.datetime = datetime(ctd.ddmmmyyyy, 'InputFormat', 'dd MMM yyyy') + ctd.HHMMSS;
ctd.datetime.TimeZone = 'America/Los_Angeles'; % PST/PDT

%% match indices
ctd.datetime = dateshift(ctd.datetime,"start","minute");

%

%20A03401
SprayCTD_psal = 33.7477;
SprayCTD_dt = datetime(2020,10,6,8,30,00,TimeZone='UTC');
SprayCTD_dt.TimeZone = 'America/Los_Angeles';
idx = ctd.datetime == SprayCTD_dt;
CTD_sal = table2array(ctd(idx,'sal'))
psaloffset = CTD_sal - SprayCTD_psal
% something off about this data. The CTD is missing data from
% October 6 2020 until Feb 2021

%

%20703401 % TT 33.7683. No 
SprayCTD_psal = %no data;
SprayCTD_dt = datetime(2020,6,30,8,30,00,TimeZone='UTC');
SprayCTD_dt.TimeZone = 'America/Los_Angeles';
idx = ctd.datetime == SprayCTD_dt;
CTD_sal = table2array(ctd(idx,'sal'))
psaloffset = CTD_sal - SprayCTD_psal

%

%20903401
SprayCTD_psal = 33.7577;
SprayCTD_dt = datetime(2020,9,3,7,30,00,TimeZone='UTC');
SprayCTD_dt.TimeZone = 'America/Los_Angeles';
idx = ctd.datetime == SprayCTD_dt;
CTD_sal = table2array(ctd(idx,'sal'))
psaloffset = CTD_sal - SprayCTD_psal

%

%21303401
SprayCTD_psal = 33.6759;
SprayCTD_dt = datetime(2021,3,25,7,30,00,TimeZone='UTC');
SprayCTD_dt.TimeZone = 'America/Los_Angeles';
idx = ctd.datetime == SprayCTD_dt;
CTD_sal = table2array(ctd(idx,'sal'))
psaloffset = CTD_sal - SprayCTD_psal

%

%21503401
SprayCTD_psal = 33.8126;
SprayCTD_dt = datetime(2021,5,5,7,30,00,TimeZone='UTC');
SprayCTD_dt.TimeZone = 'America/Los_Angeles';
idx = ctd.datetime == SprayCTD_dt;
CTD_sal = table2array(ctd(idx,'sal'))
psaloffset = CTD_sal - SprayCTD_psal

%

%22303401
SprayCTD_psal = 33.4669;
SprayCTD_dt = datetime(2022,3,10,12,30,00,TimeZone='UTC');
SprayCTD_dt.TimeZone = 'America/Los_Angeles';
idx = ctd.datetime == SprayCTD_dt; % no data
CTD_sal = table2array(ctd(idx,'sal'))
psaloffset = CTD_sal - SprayCTD_psal

%

%23303401
SprayCTD_psal = 34.0345;
SprayCTD_dt = datetime(2023,3,7,15,30,00,TimeZone='UTC');
SprayCTD_dt.TimeZone = 'America/Los_Angeles';
idx = ctd.datetime == SprayCTD_dt;
CTD_sal = table2array(ctd(idx,'sal'))
psaloffset = CTD_sal - SprayCTD_psal

%

%24402401
SprayCTD_psal = 33.6729;
SprayCTD_dt = datetime(2024,4,11,16,30,00,TimeZone='UTC');
SprayCTD_dt.TimeZone = 'America/Los_Angeles';
idx = ctd.datetime == SprayCTD_dt;
CTD_sal = table2array(ctd(idx,'sal'))
CTD_tc = table2array(ctd(idx,'temp'))
tcoffset = CTD_tc - app.meanCTD_temp
psaloffset = CTD_sal - SprayCTD_psal