clear all
a = [626	54.181	2.127	14.78	33.4	1.8
630	54.184	2.438	14.53	33.47	1.77
635	54.195	3.354	14.62	33.28	1.8
640	54.183	4.292	14.38	33.44	1.93
647	54.127	5.967	14.35	33.41	1.92
652	54.127	7.101	14.13	33.48	2.1
657 54.144 7.882 14.34 33.28 1.99
706 54.154 9.139 14.61 33.4 1.92;
710 54.144 9.896 14.41 33.43 1.98;
715 54.15 10.907 13.75 33.43 2.31;
717 54.15 11.112 13.63 33.61 2.42;
719 54.152 11.415 13.88 33.55 2.35;
721 54.156 11.716 13.78 33.29 2.33;
722 54.159 12.017 14.01 33.32 2.26;
724 54.156 12.461 13.66 33.36 2.39;
725 54.154 12.608 13.6 33.43 2.45;
726 54.151 12.751 13.41 33.46 2.38;
727 54.143 13.045 13.29 33.45 2.46;
729 54.134 13.339 13.54 33.29 2.1;
747 54.071 16.286 14.97 33.17 1.89;
749 53.969 16.186 15.17 33.2 1.88;
756 53.704 14.949 14.84 33.26 1.85;
801 53.459 13.96 14.08 33.59 1.77;
803 53.427 13.815 14.03 33.36 1.77;
804 53.361 13.527 13.75 33.31 1.8;
806 53.3 13.235 13.74 33.43 1.87;
808 53.239 12.796 13.46 33.29 2.15;
809 53.177 12.651 13.27 33.44 2.33;
812 53.054 12.082 13.83 33.3 2.24;
814 52.995 11.799 13.96 33.13 2.15;
815 52.965 11.660 13.92 33.28 2.24;
817 52.875 11.245 13.58 33.33 2.31;
819 52.788 10.831 13.64 33.29 2.24;
821 52.698 10.413 13.17 33.53 2.53;
824 52.64 10.135 13.62 33.32 2.33;
826 52.55 9.734 13.85 33.21 2.27;
829 52.414 9.202 13.85 33.39 2.34;
832 52.319 8.666 13.51 33.33 2.42;
835 52.186 8.263 13.61 33.33 2.37;
839 51.981 7.45 13.71 33.29 2.49;
845 52.266 6.646 13.69 33.3 2.66;
848 52.501 6.315 13.36 33.26 2.67;
850 52.733 5.981 13.42 33.3 2.65;
852 52.887 5.753 13.97 33.15 2.51;
854 53.114 5.416 14.03 32.97 2.32;
856 53.269 5.193 14.45 32.95 2.21;
857 53.428 4.971 14.44 33 2.19;
900 53.497 5.463 14.5 33.29 2.15;
904 53.465 6.209 14.47 33.28 2.15;
907 53.441 6.658 14.27 33.37 2.2;
910 53.398 7.254 13.94 33.34 2.34;
912 53.376 7.551 13.65 33.43 2.42;
914 53.347 7.999 13.75 33.36 2.38;
916 53.32 8.441 13.8  33.22 2.4;
918 53.3 8.737 13.62 33.18 2.44;
920 53.279 9.035 13.76 33.17 2.41;
922 53.255 9.333 13.7 33.18 2.43;
924 53.214 9.782 13.53 33.25 2.52;
925 53.187 10.078 13.3 33.25 2.48;
927 53.165 10.375 13.23 33.34 2.67;
928 53.138 10.668 13.13 33.29 2.8;
930 53.124 10.815 13.34 33.2 2.75;
931 53.093 11.109 13.34 33.1 2.7;
935 53.013 11.992 13.67 33.07 2.5;
940 52.932 12.578 13.75 33.14 2.49
];

addpath c:\muse\auv\review\JGB
%% 4 is temp; 5 is sal; 6 is fluor
figure(1); clf
surfit=1;
if surfit
surfplot(-122-(a(:, 3)/60), 36+(a(:,2)/60), a(:, 4), [50 50], [0.1 0.1]); 
set(gca, 'YDir', 'Normal');
colorbar, shading interp
hold on
end

%% YoYoZigZag
p=plot(-122-6/60,36+54/60,'ko'); set(p,'markerfacecolor','g','markersize',7);
lon=[(-122-6/60) (-122-7/60)]; lat=[(36+54/60) (36 +54/60)];p=plot(lon,lat,'k');
set(p,'linewidth',2);
lon=[(-122-7/60) (-122-6/60)]; lat=[(36+54/60) (36 +53.7/60)]; p=plot(lon,lat,'k');
set(p,'linewidth',2);
lon=[(-122-6/60) (-122-7/60)]; lat=[(36+53.7/60) (36 +53.4/60)];p=plot(lon,lat,'k');
set(p,'linewidth',2);
lon=[(-122-7/60) (-122-6/60)]; lat=[(36+53.4/60) (36 +53.1/60)];p=plot(lon,lat,'k');
set(p,'linewidth',2);
lon=[(-122-6/60) (-122-7/60)]; lat=[(36+53.1/60) (36 +52.8/60)];p=plot(lon,lat,'k');
set(p,'linewidth',2);
lon=[(-122-7/60) (-122-6/60)]; lat=[(36+52.8/60) (36 +52.5/60)];p=plot(lon,lat,'k');
set(p,'linewidth',2);
lon=[(-122-6/60) (-122-7/60)]; lat=[(36+52.5/60) (36 +52.5/60)];p=plot(lon,lat,'k');
set(p,'linewidth',2);

%% End of Leg 5
p= plot(-122-(6.324/60),36+(51.936/60),'k*'); set(p,'markersize',10);
set(gca,'Ylim',[36.86 36.905]);
return


addpath c:\muse\auv\day\ryjo
addpath c:\muse\auv\review\sw

deg=setstr(176);

load wcoastline.dat
% figure(1); clf; set(gcf,'color','w','position',[10 100 700 600]);
plot(wcoastline(:,1),wcoastline(:,2),'k');
axis([-122.3 -121.97 36.67 37.07]); hold on
sbox=[-122.25 -122 37.05 36.7 36.96];
plot(sbox([1 1 2 2]),sbox([3 4 4 5]),'b');
p=plot(-122.03,36.75,'ko'); 
%% monitoring transect
% load /u/ryjo/auv/JR/monitoring_xy; plot(x,y,'k--');

%% Plan for high_altitude 
% load flightline1; flightline2=flightline1-[.1 .1 0 0]';  
%% Plan for low_altitude
% load sslines
% plot(line1([3 4]),line1([1 2]),'r');
% plot(line2([3 4]),line2([1 2]),'k');
% plot(line3([3 4]),line3([1 2]),'r');
% [x y]=ginput(2); plot(x,y,'m'); return

load lowalt1; 
ysep=.022; % fixed y flightline separation
ep = [y x]; 
% plot(ep([3 4]),ep([1 2]),'m');
disp(['All transect longitude endpoints are 122 and 122.25' deg 'W']);
disp(['Transect latitude endpoints are:']);
for N = 0:8
 ep = [y-N*ysep x]; plot(ep([3 4]),ep([1 2]),'m');
 if rem(N,2)==0; 	% east to west
  txty = ep(1); txtx=ep(3)+.005;
  lat1deg=floor(ep(1)); lat1min=(ep(1)-floor(ep(1)))*60;
  lat2deg=floor(ep(2)); lat2min=(ep(2)-floor(ep(2)))*60;
  % eplatstr = ['(east to west) ' num2str(ep(1)) deg 'N to ' num2str(ep(2)) deg 'N'];
  eplatstr = ['(east to west) ' num2str(lat1deg) deg num2str(lat1min) '''' 'N to '...
   num2str(lat2deg) deg num2str(lat2min) '''' 'N'];
 else; 			% west to east
  txty = ep(2); txtx=ep(4)-.01;
  lat1deg=floor(ep(2)); lat1min=(ep(2)-floor(ep(2)))*60;
  lat2deg=floor(ep(1)); lat2min=(ep(1)-floor(ep(1)))*60;
  % eplatstr = ['(west to east) ' num2str(ep(2)) deg 'N to ' num2str(ep(1)) deg 'N'];
  eplatstr = ['(west to east) ' num2str(lat1deg) deg num2str(lat1min) '''' 'N to '...
   num2str(lat2deg) deg num2str(lat2min) '''' 'N'];
 end
 t=text(txtx,txty,int2str(N+1)); set(t,'fontsize',12);
 disp(['Transect ' int2str(N+1) ': ' eplatstr]);
end

[dist phas]=sw_dist(x,y,'km');
disp(['Distance along individual flight line: ' num2str(dist) ' km']);
llgrid(15);

return
%% Underway overlay of YoYoZigZag
load underway_yoyozigzagXY
dx=.005;
plot([x x],[y y+.07],'k'); 
n=1;plot([x+n*dx x+n*dx],[y y+.07],'k');
n=2;plot([x+n*dx x+n*dx],[y y+.07],'k');
n=3;plot([x+n*dx x+n*dx],[y y+.07],'k');
n=4;plot([x+n*dx x+n*dx],[y y+.07],'k');
n=5;plot([x+n*dx x+n*dx],[y y+.07],'k');

return
addpath c:\muse\auv\day\ryjo
load underwayxy; ydif=.02
   p=plot(x,y,'r'); set(p,'linewidth',2);
   LLstr=[decimal2degmin(x(1)) ' to ' decimal2degmin(x(2)) ' along ' decimal2degmin(y(1))];
   disp(['Transect 1: ' LLstr]);
 y=y-ydif; p=plot(x,y,'r'); set(p,'linewidth',2);
  LLstr=[decimal2degmin(x(1)) ' to ' decimal2degmin(x(2)) ' along ' decimal2degmin(y(1))];
   disp(['Transect 2: ' LLstr]);
y=y-ydif; p=plot(x,y,'r'); set(p,'linewidth',2);
  LLstr=[decimal2degmin(x(1)) ' to ' decimal2degmin(x(2)) ' along ' decimal2degmin(y(1))];
   disp(['Transect 3: ' LLstr]);
y=y-ydif; p=plot(x,y,'r'); set(p,'linewidth',2);
  LLstr=[decimal2degmin(x(1)) ' to ' decimal2degmin(x(2)) ' along ' decimal2degmin(y(1))];
   disp(['Transect 4: ' LLstr]);
y=y-ydif; p=plot(x,y,'r'); set(p,'linewidth',2);
   LLstr=[decimal2degmin(x(1)) ' to ' decimal2degmin(x(2)) ' along ' decimal2degmin(y(1))];
   disp(['Transect 5: ' LLstr]);

  load underwayxy; 
  
p=plot(x([2 2]),[y(1) y(1)-.02],'r'); set(p,'linewidth',2);
p=plot(x([2 2]),[y(1)-.04 y(1)-.06],'r'); set(p,'linewidth',2);
p=plot(x([1 1]),[y(1)-.02 y(1)-.04],'r'); set(p,'linewidth',2);
p=plot(x([1 1]),[y(1)-.06 y(1)-.08],'r'); set(p,'linewidth',2);

return

t=text(-122.25,37.2,'MBARI AVIRIS Low-Altitude Flight Request');
set(t,'fontweight','bold','fontsize',12);
t=text(-122.25,37.17,'Substitute for original ER-2 request');
set(t,'fontweight','bold','fontsize',12);
t=text(-122.25,37.14,'Window: August 21 - September 2, 2000');
set(t,'fontweight','bold','fontsize',12);
t=text(-122.2,37.10,'Each transect = 15 nautical miles');
set(t,'fontweight','bold','fontsize',12);
t=text(-122.2,37.06,'Sequential transect starting points are numbered');
set(t,'fontweight','bold','fontsize',12);
% t=text(-122,37.10,'Baseline 3-transect pattern');
% set(t,'fontweight','bold','fontsize',12);
% t=text(-122,37.05,'Continue pattern to south...');
% set(t,'fontweight','bold','fontsize',12);
% load flightline1; 
% flightline1=flightline1+[.015 .015 0 0]';  
% flightline2=flightline1+[.025 .025 0 0]';  
% flightline3=flightline1-[.025 .025 0 0]';  


% plot(flightline1([3 4]),flightline1([1 2]),'k--');
% plot(flightline2([3 4]),flightline2([1 2]),'r--');
% plot(flightline3([3 4]),flightline3([1 2]),'r--');

flightline1=abs(flightline1); disp(['Transect 1:']);
lat1deg=floor(flightline1(1)); lat1min=(flightline1(1)-floor(flightline1(1)))*60;
lon1deg=floor(flightline1(3)); lon1min=(flightline1(3)-floor(flightline1(3)))*60;
disp(['LAT1 : ' num2str(lat1deg) deg num2str(lat1min)]);
disp(['LON1 : ' num2str(lon1deg) deg num2str(lon1min)]);

% t=text(-122.1,36.92,'<--'); 
% set(t,'fontweight','bold','fontsize',12,'rotation',-28);
% t=text(-122.1,36.82,'-->'); 
% set(t,'fontweight','bold','fontsize',12,'rotation',-28);
% t=text(flightline1(3)+.02,flightline1(1),'Line 1');
% set(t,'fontweight','bold','fontsize',12);
% t=text(flightline2(3)+.02,flightline2(1),'Line 2');
% set(t,'fontweight','bold','fontsize',12);
t=text(-122.25,37.2,'AVIRIS Low-Altitude Flight Request');
set(t,'fontweight','bold','fontsize',15);
t=text(-122.25,37.15,'Window: August 17-31, 2000');
set(t,'fontweight','bold','fontsize',15);
llgrid(15);

%% transect endpoints

disp([' ']);
flightline1=abs(flightline1); disp(['Transect 1:']);
lat1deg=floor(flightline1(1)); lat1min=(flightline1(1)-floor(flightline1(1)))*60;
lat2deg=floor(flightline1(2)); lat2min=(flightline1(2)-floor(flightline1(2)))*60;
lon1deg=floor(flightline1(3)); lon1min=(flightline1(3)-floor(flightline1(3)))*60;
lon2deg=floor(flightline1(4)); lon2min=(flightline1(4)-floor(flightline1(4)))*60;
disp(['LAT1 : ' num2str(lat1deg) deg num2str(lat1min)]);
disp(['LON1 : ' num2str(lon1deg) deg num2str(lon1min)]);
disp([' ']);
disp(['LAT2 : ' num2str(lat2deg) deg num2str(lat2min)]);
disp(['LON2 : ' num2str(lon2deg) deg num2str(lon2min)]);

disp([' ']); disp([' ']);
flightline2=abs(flightline2); disp(['Transect 2:']);
lat1deg=floor(flightline2(1)); lat1min=(flightline2(1)-floor(flightline2(1)))*60;
lat2deg=floor(flightline2(2)); lat2min=(flightline2(2)-floor(flightline2(2)))*60;
lon1deg=floor(flightline2(3)); lon1min=(flightline2(3)-floor(flightline2(3)))*60;
lon2deg=floor(flightline2(4)); lon2min=(flightline2(4)-floor(flightline2(4)))*60;
disp(['LAT1 : ' num2str(lat2deg) deg num2str(lat2min)]);
disp(['LON1 : ' num2str(lon2deg) deg num2str(lon2min)]);
disp([' ']);
disp(['LAT2 : ' num2str(lat1deg) deg num2str(lat1min)]);
disp(['LON2 : ' num2str(lon1deg) deg num2str(lon1min)]);


