filepath='/Users/jhooper/Documents/Work_data/WBTS/ab1202/Documents/surface_prs.txt'

%read in surface pressure variables
[stt dckpsrt dckpend spstrt spend] = ...
    textread(filepath,'%f%*f%f%f%f%f','headerlines',1);

%%%% calculate standar devation and mean of deck and surface pressures %%%%

%stations 0-33 indices(1:34)
%stations 34-58 indices(35:59)

%on deck start
median_dckpsrt=median(dckpsrt)
stddev_dckpsrt=std(dckpsrt)

%on deck end
median_dckpend=median(dckpend)
stddev_dckpend=std(dckpend)

%differences of the median
%stt 1:33
median(dckpsrt(1:34)-dckpend(1:34))
%stt 34:58
median(dckpsrt(35:59)-dckpend(35:59))

%surface start
median_spstrt=median(spstrt)
stddev_spstrt=std(spstrt)

%surface end
median_spend=median(spend)
stddev_spend=std(spend)


%%%%%%%%%%%%%%%%%%%%%%%% Plot deck pressure %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


f1
clf
font(16)
subplot(2,1,1)
plot(stt,dckpsrt,'b')
hold on;
plot(stt,dckpend,'r')
hold on;
plot(stt,(dckpsrt-dckpend),'g')
title('On Deck Pressure','fonts',16)
ylabel('Pressure (db)','fonts',16)
%xlabel('Station','fonts',16)
legend('Start','End','Difference')

%%%%%%%%%%%%%%%%%%%%%%%% Plot surface pressure %%%%%%%%%%%%%%%%%%%%%%%%%%%%

subplot(2,1,2)
plot(stt,spstrt,'b')
hold on;
plot(stt,spend,'r')
hold on;
plot(stt,(spstrt-spend),'g')
title('Surface Pressure','fonts',16)
ylabel('Pressure (db)','fonts',16)
xlabel('Station Number','fonts',16)
legend('Start','End','Difference')

%%%%%%%%%%%%%%%%%%%%%%%%%%%% get end btl prs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%This gets the surface pressure (not on deck prs) at the end of each cast.
if 0,
for i=1:59
   min_depth=min(btl(:,i).PrDM);
   prof(i)=min_depth;
end;
end;
