%trackplt.m

% ttmnav

clear all

t1s=input('enter first UTC yymmdd-hhmm[ss]: ','s')
t2s=input('enter last  UTC yymmdd-hhmm[ss]: ','s')
nss=input('enter  integer subsamp interval: ','s')

us = unix(['gpssel.run ' t1s ' ' t2s ' ' nss])

load gpssel.out

hhmmss  = gpssel(:,1)';
latddmm = gpssel(:,2)';
londdmm = gpssel(:,3)';
stat    = gpssel(:,4)';
nsat    = gpssel(:,5)';
dop     = gpssel(:,6)';
sow     = gpssel(:,7)';
hdg     = gpssel(:,8)';
pitch   = gpssel(:,9)';
roll    = gpssel(:,10)';
mrms    = gpssel(:,11)';
brms    = gpssel(:,12)';
clear gpssel

hh = floor(hhmmss/10000);
mmss = hhmmss - hh*10000;
mm = floor(mmss/100);
ss = mmss - mm*100;

sod = hh*3600 + mm*60 + ss;
hod = sod / 3600;

dd = floor(londdmm/100);
mm = londdmm - dd*100;
lon = dd + mm/60;

dd = floor(latddmm/100);
mm = latddmm - dd*100;
lat = dd + mm/60;

j=find(hdg==999);
hdg(j)=NaN;
pitch(j)=NaN;
roll(j)=NaN;

j=find(mrms > 0.0100 | brms>0.1000);
hdg(j) = NaN;
pitch(j) = NaN;
roll(j) = NaN;
mrms(j) = NaN;
brms(j) = NaN;


%figure(gcf); clf
plot(-lon,lat,'r.')
hold on 

%range = [-129.1 -125.7 38.6 42.2];
%range = [-129 -126.2 38.5 41.5];
range = [-129 -124 39.0 45.0];

axis(range);
grid on 
orient tall
print
%print -depsc site.eps

% make map conformal at mid latitude
%a=axis; midlat=(a(4)+a(3))/2;
%set(gca,'DataAspectRatio',[1,cos(midlat*pi/180),1])
