% Sample MATLAB script to read cloud cleared output
%   ver 0.1  Mar 15, 2005    
%
% Question/Comment:
%    Dr. Jun Li   <jun.li@ssec.wisc.edu>
%    Chian-Yi Liu <cyliu@ssec.wisc.edu>
%

dim.nlen      = 2400;
dim.accross   = 90;
dim.scanlines = 135;
spvalue       = -999;

data = zeros([dim.nlen, dim.accross, dim.scanlines]);

fid = fopen('./cloud_cleared.bin','r','ieee-be');
 tmp = fread(fid,[1 inf],'float32');
fclose(fid); 

tmp(tmp == spvalue) = NaN;
 
data = reshape(tmp,[dim.nlen, dim.accross, dim.scanlines]); clear tmp fid;

% data structures are as follow:
%   (   1~2378, :, :)  -- AIRS spectral brightness temperature [unit: K]
%   (     2379, :, :)  -- FOV latitude
%   (     2380, :, :)  -- FOV longitude
%   (     2381, :, :)  --   9 
%   (     2382, :, :)  -- FOV scan angle
%   (     2383, :, :)  -- FOV topog
%   (2384~2400, :, :)  -- Reserved for future use

lon = squeeze(data(2379,:,:)) ;
lat = squeeze(data(2380,:,:)) ;

%
