% this one generates sig and plots it also
% temperature sensors: 10983 10984 10986 11177
% pressure sensors: 9791 9792

load s5_09792
load s5_09791
tow_start = 245.8379;
tow_end = 245.8440;

figure(1)
clf
clear h
%%%%%%%%%%%%%%%
% RBR DR-1050  3.50 009791
% get start time and interval

% this produces a vector of data
eval(['!tail +15 s',int2str(sam),'_009791.dat >xxx'])
load xxx
ttt=[0:length(xxx)-1]*dt+st_time;

pr9791=xxx;
ti9791=ttt;


eval(['save s',int2str(sam),'_009791 pr9791 ti9791 h9791'])  

aa=find(ttt >= tow_start & ttt <= tow_end);
h(1)=plot(ttt(aa),xxx(aa),'b');
h1_str=['9791 ',num2str(h9791),'m'];
hold on

%%%%%%%%%%%%%%%
% RBR DR-1050  3.50 009792 
% get start time and interval

% this produces a vector of data
eval(['!tail +15 s',int2str(sam),'_009792.dat >xxx'])
load xxx
ttt=[0:length(xxx)-1]*dt+st_time;

pr9792=xxx;
ti9792=ttt;
eval(['save s',int2str(sam),'_009792 pr9792 ti9792 h9792'])

aa=find(ttt >= tow_start & ttt <= tow_end);
h(2)=plot(ttt(aa),xxx(aa),'g');

h2_str=['9792 ',num2str(h9792),'m'];

% CTD
if sam < 10
  eval(['load ../sled/SAM_00',int2str(sam),'_fl'])
else
  eval(['load ../sled/SAM_0',int2str(sam),'_fl'])
end
bb=find(sampl==1);
h(3)=plot(yearday(bb),press(bb),'m');
s_str='sled at 0m';

ax=axis;
axis([tow_start tow_end ax(3:4)])

%legend(h,h1_str,h2_str,s_str)

xlabel('Yearday 2005')
ylabel('Pressure (dbar)')
title(['RBR DR-1050 data from Sample Tow: ',int2str(sam)])
axis ij

orient portrait
eval(['print -dpng sam',int2str(sam),'_p'])
orient landscape

