function [lon,lat,refldbz] = readlf(fname)


fid = fopen(fname,'r','b');


%%% READ THE HEADER
c = fread(fid,124,'uint8=>char');

keyword = char(c(5:8)');
fltid   = char(c(9:16)');
storm   = char(c(17:28)');
radar   = char(c(29:32)');
tracknm = char(c(33:64)');
filecrt = char(c(65:96)');
fltnm   = char(c(97:124)');

idat = fread(fid,10,'int32','b');
imax = idat(1);
jmax = idat(2);

fdat = fread(fid,24,'float32','b');
stime = fdat(1);
etime = fdat(2);
alat  = fdat(3);
alon  = fdat(4);
dx    = fdat(5);
dy    = fdat(6);
dz    = fdat(7);
xd    = fdat(8);
yd    = fdat(9);
zd    = fdat(10);
rot   = fdat(11);
ralt  = fdat(12);
dbzc1 = fdat(13);
dbzc2 = fdat(14);
azcor = fdat(15);
elcor = fdat(16);
dbztr = fdat(17);
bbzmx = fdat(18);
ptcor = fdat(19);
dfcor = fdat(20);
rlcor = fdat(21);
rngmx = fdat(22);
bbdht = fdat(23);
bbdth = fdat(24);

%%% READ THE REFLECTIVITY DATA
kpac = zeros(32767,1,'uint16');
for jx=1:jmax
    j = jmax+1-jx;
    n1 = floor(((j-1)*imax+2)/2);
    n2 = floor((imax+(j-1)*imax+1)/2);
    len = n2-n1+1;
    fread(fid,4,'uint16','b');
    kpac(n1:n2) = fread(fid,len,'uint16','b');
end


%%%% UNPACK BYTES AND STORE IN 2-D ARRAY
refldbz = zeros(imax,jmax);
for j = 0:jmax-1
for i = 0:imax-1
    
    ii = i+1;
    jj = j+1;
    n = floor((ii + (jj-1)*imax + 1) / 2);
    if (mod(ii,2) == 0)
       l = bitand((kpac(n)), 255);
    else
       l = bitshift((kpac(n)), -8);
    end
    z = double((l - 64.0) / 2.0);
    if (l == 0)  
       z = nan;
    end
    refldbz(i+1,j+1) = z;
end
end
refldbz = (refldbz)';

%%%% LOCATION
dlat = dy/1.111e2;      
ylat  = alat+dlat*(-(jmax-1)/2:(jmax-1)/2);
dlon = dx./(1.111e2.*cos(ylat*pi/180));
xlon  = alon+dlon.*(-(imax-1)/2:(imax-1)/2);
[lon,lat] = meshgrid(xlon,ylat);

fclose(fid)

%%%% PLOT REFLECTIVITY
%contourf(lon,lat,refldbz);

