function [nav] = rd_navdata(filename);
%
%       function [nav] = rd_navdata(filename);
%
%   ....Reads SSEC binary files (*.bac) containing ER-2 navigation data.
%
%       Written by Von P. Walden
%                  14 May 1998
%

fp = fopen(filename,'r','ieee-le');
nbytes = fread(fp,1,'int32');
record_number = fread(fp,1,'int32');
nav.hdr = char(fread(fp,192,'char'))';
YY = str2num(nav.hdr(32:33));
MM = str2num(nav.hdr(26:27));
DD = str2num(nav.hdr(29:30));
nav.YYMMDD = YY*10000 + MM*100 + DD;

tmp = fread(fp,inf,'float32');
%tmp = reshape(tmp,10,length(tmp)/10);
fclose(fp);

N = length(tmp);
nav.time        = tmp(1:10:N);
nav.latitude    = tmp(2:10:N);
nav.longitude   = tmp(3:10:N);
nav.altitude    = tmp(4:10:N);
nav.heading     = tmp(5:10:N);
nav.pitch       = tmp(6:10:N);
nav.roll        = tmp(7:10:N);
nav.speed       = tmp(8:10:N);
nav.pressure    = tmp(9:10:N);
nav.temperature = tmp(10:10:N);

