function nav_from_dvla(xls_root,out_root,z0,BATHY)
%
% Call nav_from_dvla(xls_root,out_root,z0,BATHY);
%
% Converts Excel files to NAV files
%
% Example call:     nav_from_indy('Sept','Indy',45,BATHY);
%
%
% COPYRIGHT (c) 2008
% 
% Applied Research Laboratories, The University of Texas at Austin
% (ARL:UT)
% All rights reserved.
% 
% This material may be reproduced by or for the U.S. Government
% only. This notice must appear in all copies of this file and its
% derivatives. Further distribution outside the U.S. Government is
% prohibited without the explicit written authorization from the
% Director of the Environmental Sciences Laboratory, ARL:UT.
% 
% THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
% EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE
% IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
% PURPOSE, OR NONINFRINGEMENT.
% 
% IN NO EVENT WILL ARL:UT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING
% OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN IF ARL:UT HAS
% BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
D=dir([xls_root,'*.xls']); nfile=length(D);
%
month='SEP';
for jfile=1:nfile,
    day=str2num(D(jfile).name(6:7)),
    Jday=date_to_Jday(month,day,2001);
    D(jfile).name
    [data,text]=xlsread([D(jfile).name]); 
    ii=find(~isnan(data(:,1)));
    iisg_ns=1; if strcmp(text(ii(1),4),'S'), iisg_ns=-1; end
    iisg_ew=1; if strcmp(text(ii(1),7),'W'), iisg_ew=-1; end
    NAV.nav_file=[out_root,'_',month,'_',int2str(day),'_',int2str(Jday),'_NAV'];
    NAV.log_file=D(jfile).name;
%	NAV.svg_root=SVGx.out_root;
	NAV.jday=Jday;
	NAV.hour=data(ii,1)*24;
	NAV.min=(NAV.hour-NAV.hour(1) ) * 60;		% Minute after start of file
	NAV.lat=iisg_ns*(data(ii,2) + data(ii,3)/60);
	NAV.long=iisg_ew*(data(ii,5) + data(ii,6)/60);
	NAV.bathy_root=BATHY.bathy_root;
	[NAV.xkm,NAV.ykm]=bathy_ll2xy(NAV.lat,NAV.long);
    NAV.z=z0*ones(size(NAV.xkm));
	vx=gradient(NAV.xkm,NAV.hour); vy=gradient(NAV.ykm,NAV.hour);
	NAV.v=sqrt(vx.^2 + vy.^2) * (1000/3600);
	NAV.phi=atan2(vx,vy);    
%
    str=['save ..\',NAV.nav_file,' NAV']; eval(str);
end
