
% overlay dgps ranges, ship's track and smithandsandwell bathy chart

clear all

witch=4; % 1 for FBC, 2 for HOME, 3 for Mendo, 4 for Georges Bank

switch witch
case 1
	latmin = 55; latmax = 65; lonmin = -15; lonmax = -1;
case 2
	latmin = 15; latmax = 30; lonmin = -177; lonmax = -153;
	latmin = 18; latmax = 25; lonmin = -167; lonmax = -155;
	latmin = 20; latmax = 26; lonmin = -168; lonmax = -157;
case 3
	latmin = 39; latmax = 45; lonmin = -129; lonmax = -123;
case 4
	latmin = 40; latmax = 45; lonmin = -72; lonmax = -65;
end

clf
worldmap([latmin latmax],[lonmin lonmax],'patch')

if 0 % plot the DGPS transmitting sites and max radio propagation distance
switch witch
case 1
lat0(1)=62.0;     lon0(1)= -6.75;    rngkm(1)=180; % Faroe Islands
lat0(2)=59+51/60; lon0(2)= -1-16/60; rngkm(2)=277; % Sumburgh Head
lat0(3)=58+31/60; lon0(3)= -6-16/60; rngkm(3)=277; % Butt of Lewis
lat0(4)=57+ 8/60; lon0(4)= -2- 3/60; rngkm(4)=277; % Girdle Ness
lat0(5)=64+39/60; lon0(5)=-14-17/60; rngkm(5)=310; % Djupivogur, Iceland
case 2
lat0(1)=20+14/60+48/3600; lon0(1)=-155-53/60-12/3600; rngkm(1)=275; % Upolu Pt
lat0(2)=22+03/60+30/3600; lon0(2)=-159-46/60-34/3600; rngkm(2)=485; % Kokole Pt
end

	for sn=1:length(lat0)
		h=linem(lat0(sn),lon0(sn),'r.');
		set(h,'MarkerSize',20)
		rngdeg= rngkm(sn) / 100;
		az=0:1:360;
		i=ones(size(az));
		[lat,lon]=reckon(lat0(sn)*i,lon0(sn)*i,rngdeg*i,az);
		h=linem(lat,lon,'r');
		% set(h,'MarkerSize',1)
	end
end

%if 1 % plot ship's track
%	switch witch
%	case 2, G = load('/home/dunlap/home/g12/gpssub.mat');
%	case 3, G = load('/home/dunlap/avp/mendo/gpssub.mat');
%	end
%	n = length(G.lat);
%	nss = 6; % subsample to 1 hour
%	j = 1:nss:n;
%	h = linem(G.lat(j),G.lon(j),'r.');
% 	set(h,'MarkerSize',10)
%end

% get data from smith and sandwell database
[img,lat,lon] = mygrid_sand([latmin,latmax,lonmin,lonmax]);

switch witch
case 1, zvals = [-2500, -2000, -1750, -1500, -1250, -1000, -750, -500, -250, 0];
case 2,	zvals = [-5600, -5500, -5000, -4000, -3000, -2000, -1000];
case 3,	zvals = [-4500,-4000,-3500,-3000,-2000,-1000];
%case 4, zvals = [-1000, -500, -300, -200, -100, 0];
case 4, zvals = [-200, -100, -60];    
end

% contour smith and sandwell bathy data
contorm(lat,lon,img,zvals);
orient portrait
%print;

% end
