function [] = nav_plot(print_flag,filedate)
%
%       function [] = nav_plot(print_flag,filedate)
%
%   ....Makes a plot of the navigation data taken during HIS flight.
%
%        Example input: nav_plot(0,980513);
%
%        Input:
%          print_flag   - Flag for printing hard copies (1 for yes, 0 for no hard copies).
%
%          filedate - This is a NUMBER that designates the date that the HIS
%                       data was taken, ie, 980513.
%
%                NOTE:  This routine requires a NASA BAC NAVDATA file to be 
%                        in the following directory structure (assuming
%                        filedate = 980513 and flight_track = '98-063'):
%
%                        [direc]\ac980513\98-063.BAC
%
%                        where [direc] is hardwired in below.
%
%
%       Adapted from Dave Tobin's script by Von P. Walden
%                 14 May 1998
%       Updated   27 May 1998 (Eliminated need to enter the flight track.)
%

%
%   ....Sets hardwired directory structure.
%
direc = 'd:\fireiii\data\HIS\';    % This line is changed depending on the dir structure.
direc = [direc,'ac',num2str(filedate),'\'];

%
%   ....Gets the existing BAC file in the correct directory.
%
bac_file = dir([direc,'*.bac']);
if(length(bac_file) == 0)
   sprintf('Could NOT locate the BAC NAVDATA file.')
   return;
end
flight_track = bac_file.name(1:length(bac_file.name)-4);
filename = [direc,bac_file.name];

%
%   ....Reads nav data.
%
eval(['[navdata] = rd_navdata(''',filename,''');']);

%
%   ....Plots nav data.
%
load coastlin 
plot(navdata.longitude,navdata.latitude,'r-',coastlines(1,:),coastlines(2,:),'k');grid
axis([-175 -145 60 80])
%set(gca,'Position',[.59 .08 .4 .4],'FontWeight','b')
%set(gca,'XLim',[min(longitude)-15 max(longitude)+15],'YLim',[min(latitude)-15 max(latitude)+15]);
%axis square
xlabel('longitude');
ylabel('latitude')
title(['ER-2 flight track# ',flight_track,' on ',num2str(filedate)])
set(gcf,'PaperPositionMode','auto');
eval(['print -djpeg ',direc,'ER2_flight_track_',num2str(filedate),'.jpg']);
if print_flag print -dwinc; end

axis off
set(gcf,'PaperPosition',[4 4 0.75 0.75]);
eval(['print -djpeg ',direc,'ER2_flight_track_',num2str(filedate),'_small.jpg']);


