clear all

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.6 -121.5 36.5 37.25]); 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 lowalt1b; 
ysep=.03; % 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)-.02;
  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);

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);
return

% 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)]);


