close all;
load ab1209_db

match_abaco = cond_match;

path=[pwd,'/figures'];
%%%%%%%%%%%%%%%%%%%% plot abaco section btl dphs %%%%%%%%%%%%%%%%%%%%%%%%%%
f1=bigplot;
sts=1;
ste=27;
for i=sts:ste,
   sta=i+7;
   %bta=i;
   lon(i)=cnv_load(sta).longitude;
   lat(i)=cnv_load(sta).latitude;
   st=find(cond_match.stnnbr == sta);
   max_depth=max(cond_match.ctdprs(st));
   prof(i)=max_depth;
end

%find indices of desired stations
stbt=find(cond_match.stnnbr >= sts+7 & cond_match.stnnbr <= ste+7);

%plot(cond_match.stnnbr(stbt),cond_match.ctdprs(stbt),'k+','markersize',8)
plot(cond_match.longitude(stbt),cond_match.ctdprs(stbt),'b+','markersize',8)
revyaxis
ylabel('Pressure','fonts',16)
xlabel('Longitude','fonts',16)
title('Abaco Section Bottle Depth Locations','fonts',16)
font(14)
hold on
patch([ lon -69.98 -69.98 -76.89 -76.89] ,[ prof+40 5610 6000 6000 450 ],'w','LineWidth',3);
xlim(-76.9,-69.97)
legend('Bottle fire depths','location','south')
k=0;
for j=1:length(lon)
    stt=8+k;
    text(lon(j)-0.02,-30,num2str(stt),'fonts',9)
    k=k+1;
end;
noaalogo([0.28 0.13 0.12 0.12])
set(gcf, 'PaperPositionMode', 'auto');
print ('-depsc2',[path,'/btl_dph_abaco.eps'])

%%%%%%%%%%%%%%%%%%%% plot providence section btl dphs %%%%%%%%%%%%%%%%%%%%%
clear i sta bta lon lat st max_depth prof stbt j

f2=bigplot;
% NW Providence stations 34 to 38
sts=1;
ste=5;
for i=sts:ste
   sta=i;
   %bta=sta-1;
   lon(i)=cnv_load(sta).longitude;
   lat(i)=cnv_load(sta).latitude;
   st=find(cond_match.stnnbr == sta);
   max_depth=max(cond_match.ctdprs(st));
   prof_prov(i)=max_depth;
end

%find indices of desired stations
stbt=find(cond_match.stnnbr >= sts & cond_match.stnnbr <= ste);


%plot(cond_match.stnnbr(stbt),cond_match.ctdprs(stbt),'k+','markersize',8)
plot(cond_match.latitude(stbt),cond_match.ctdprs(stbt),'b+','markersize',8)
revyaxis
ylabel('Pressure','fonts',16)
xlabel('Longitude','fonts',16)
title('Providence Bottle Depth Locations','fonts',16)
font(14)
hold on
patch([lat 26.45 26.45 26.05 26.05 ], ...
    [prof_prov+10 760 800 800 300],'w','LineWidth',3);
%xlim(-77,-69.5)
legend('Bottle fire depths','location','south')
k=0;
for j=1:length(lat)
    stt=1+k;
    text(lat(j)-0.001,-5,num2str(stt),'fonts',9)
    k=k+1;
end;
noaalogo([0.28 0.13 0.12 0.12])
set(gcf, 'PaperPositionMode', 'auto');
print ('-depsc2',[path,'/btl_dph_providence.eps'])


%%%%%%%%%%%%%%%%%%%%%%% plot 27 N section btl dphs %%%%%%%%%%%%%%%%%%%%%%%%
clear i sta bta lon lat st max_depth prof stbt j k

f3=bigplot;
% 26N stations 50 to 58
sts=1;
ste=9;
for i=sts:ste
   sta=i+36;
   %bta=sta-1;
   lon(i)=cnv_load(sta).longitude
   lat(i)=cnv_load(sta).latitude
   st=find(cond_match.stnnbr == sta)
   max_depth=max(cond_match.ctdprs(st))
   prof(i)=max_depth
end

%find indices of desired stations
stbt=find(cond_match.stnnbr >= sts+36 & cond_match.stnnbr <= ste+36);

%plot(cond_match.stnnbr(stbt),cond_match.ctdprs(stbt),'k+','markersize',8)
plot(cond_match.longitude(stbt),cond_match.ctdprs(stbt),'b+','markersize',8)
revyaxis
ylabel('Pressure','fonts',16)
xlabel('Longitude','fonts',16)
title('27N Bottle Depth Locations','fonts',16)
font(14)
hold on
patch([lon -79.18 -79.18 -80 -80 ], ...
    [prof+10 400 800 800 70],'w','LineWidth',3);
xlim(-80,-79.18)
legend('Bottle fire depths','location','southeast')
k=0;
for j=1:length(lon)      
    stt=50+k;
    text(lon(j)-0.001,-5,num2str(stt),'fonts',9)
    k=k+1; 
end;
noaalogo([0.28 0.13 0.12 0.12])
set(gcf, 'PaperPositionMode', 'auto');
print ('-depsc2',[path,'/btl_dph_27N.eps'])
return
%%%%%%%%%%%%%%%%%%%%%%% plot 26 N section btl dphs %%%%%%%%%%%%%%%%%%%%%%%%
clear i sta bta lon lat st max_depth prof stbt j k

f4=bigplot;
% 26N stations 39 to 49
for i=1:11
   sta=i+39;
   bta=sta-1;
   lon(i)=cnv_load(sta).longitude;
   lat(i)=cnv_load(sta).latitude;
   st=find(cond_match.stnnbr == bta);
   max_depth=max(cond_match.ctdprs(st));
   prof(i)=max_depth;
end

%find indices of desired stations
stbt=find(cond_match.stnnbr >= 39 & cond_match.stnnbr <= 49);

%plot(cond_match.stnnbr(stbt),cond_match.ctdprs(stbt),'k+','markersize',8)
plot(cond_match.longitude(stbt),cond_match.ctdprs(stbt),'b+','markersize',8)
revyaxis
ylabel('Pressure','fonts',16)
xlabel('Longitude','fonts',16)
title('26N Bottle Depth Locations','fonts',16)
font(14)
hold on
patch([lon(11:-1:1) -79.2 -79.2 -80.1 -80.1 ], ...
    [prof(11:-1:1)+10 350 800 800 100],'w','LineWidth',3);
xlim(-80.1,-79.2)
legend('Bottle fire depths','location','southeast')
k=0;
for j=1:length(lon)      
    stt=39+k;
    text(lon(j)-0.001,-5,num2str(stt),'fonts',9)
    k=k+1; 
end;
noaalogo([0.28 0.13 0.12 0.12])
set(gcf, 'PaperPositionMode', 'auto');
print ('-depsc2',[path,'/btl_dph_26N.eps'])

%%%%%%%%%%%%%%%%%%%%%%%%%%%% plot dip cast %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if 0,
%subplot(1,2,1)
%stations 29-33
f5=bigplot;
for i=1:5
   sta=i+29;
   bta=i;
   lon(i)=cnv_load(sta).longitude;
   lat(i)=cnv_load(sta).latitude;
   st=find(cond_match.stnnbr == bta);
   max_depth=max(cond_match.ctdprs(st));
   prof(i)=max_depth;
end

%find indices of desired stations
stbt=find(cond_match.stnnbr >= 29 & cond_match.stnnbr <= 33);

%plot(cond_match.stnnbr(stbt),cond_match.ctdprs(stbt),'k+','markersize',8)
plot(cond_match.longitude(stbt),cond_match.ctdprs(stbt),'b+','markersize',8)
revyaxis
ylabel('Pressure','fonts',16)
xlabel('Longitude','fonts',16)
title('Dip casts Bottle Depth Locations','fonts',16)
font(14)
hold on
patch([ lon -76.9 -76.9 -75.6 -75.6 ] ,[ prof+40 5600 6000 6000 5600 ],'w','LineWidth',3);
xlim(-76.9,-75.6)
legend('Bottle fire depths','location','southwest')
k=0;
for j=1:length(lon) 
    stt=29+k;
    text(lon(j)-0.01,-30,num2str(stt),'fonts',8)
    k=k+1;
end;
noaalogo([0.28 0.16 0.12 0.12])
end;