% picarro_timestamp_check.m

% create DAS-like files from raw picarro file.  DAS was not
% acquiring serial data from jd 237 10 to 239 02.

% look for timing jumps in the picarro raw data files
% put all files in desktop folder 'temp'

cd('/Users/fluxuser/Desktop/temp');
files = dir('ghg0*.txt');

ts = NaN(148000*length(files),1);
iii = 1;
for ii=1:length(files)
    picr = read_picarro_raw_raw_mosaic_2019(files(ii).name);
    N = length(picr);
    ts(iii:iii+N-1) = picr(:,1);
    iii = iii + N;
end
xx = find(isnan(ts),1,'first');
ts = ts(1:xx-1);
figure; plot(diff(ts)*86400); grid;
ylim([0,0.3]);

% look at DAS timestamp too
files = dir('son0*.txt');

tson = NaN(36005*length(files),1);
iii = 1;
for ii = 1:length(files)
    son = read_sonic3D_ship_mosaic_2019_txt(files(ii).name);
    N = length(son);
    tson(iii:iii+N-1) = son(:,1);
    iii = iii + N;
end
xx = find(isnan(tson),1,'first');
tson = tson(1:xx-1);
figure; plot(diff(tson)*86400); grid;
ylim([0,0.3]);


