%  First try connect the points strategy...
clear all;
load dataCTD
load dataN

fix_temp_freq;

%  Now make hand edits..

tft(1:2300) = tf(1:2300); 
tft(2046)=tft(2046) + delta; 
tft(2301:3900)=tft(2301:3900) + 2*delta; 
tft(3901:3903)=tft(3901:3903) + delta; 
tft(5222:5225)=tft(5222:5225) + delta;
tft(5226:5603)=tft(5226:5603) + 2*delta;
tft(5610:n)=tft(5610:n) - delta;
tft(5604:5605)=tft(5604:5605)+ delta;
tft(5608:5609)=tft(5608:5609)- 2*delta;
tft(15309:n)=tft(15309:n) + delta;

%  Replace the old with the new....

ctdlog(:, temp_frequency) = tft;

clear tft; clear tf; clear n;

% Compute depth in time-base of CTD data

ctd_depth = ctd_depth_prep(dataNav(:,1), dataNav(:,mDepth), ctdlog(:,1));

% Now compute pressure in dB from depth

dBar = sw_pres(ctd_depth, 36.8);  % Use 36.8 as latitude....

% Now compute temperature and conductivity using the correct coefficients

[temp,cond,mask] = ctd_freq_conv(dBar, ctdlog(:,cond_frequency), ctdlog(:,temp_frequency), 'day_old' );

ctdlog(:, temperature) = temp;

clear temp;  clear cond; clear mask;

save dataCTD OBS cond_frequency conductivity ctdlog fluor o2current o2temp pH spare temp_frequency temperature time


