Home > atmlab > sensors > atovs > avhrr_define_gac_l1b.m

avhrr_define_gac_l1b

PURPOSE ^

avhrr_define_gac_l1b Get AVHRR GAC L1B header and line definitions

SYNOPSIS ^

function [head, line] = avhrr_define_gac_l1b

DESCRIPTION ^

 avhrr_define_gac_l1b Get AVHRR GAC L1B header and line definitions

 Reads the AVHRR L1B header and line definitions from HTML pages
 in ATMLAB_DATA.

 FORMAT

   [head, line] = avhrr_define_gac_l1b

 OUT

   head    struct
   line    struct

 $Id: avhrr_define_gac_l1b.m 8340 2013-04-16 17:02:42Z gerrit $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

avhrr_define_gac_l1b.m

SOURCE CODE ^

0001 function [head, line] = avhrr_define_gac_l1b
0002 
0003 % avhrr_define_gac_l1b Get AVHRR GAC L1B header and line definitions
0004 %
0005 % Reads the AVHRR L1B header and line definitions from HTML pages
0006 % in ATMLAB_DATA.
0007 %
0008 % FORMAT
0009 %
0010 %   [head, line] = avhrr_define_gac_l1b
0011 %
0012 % OUT
0013 %
0014 %   head    struct
0015 %   line    struct
0016 %
0017 % $Id: avhrr_define_gac_l1b.m 8340 2013-04-16 17:02:42Z gerrit $
0018 
0019 % See ATMLAB_DATA_PATH/sensors/avhrr/README for how to regenerate this
0020 % mat-file if necessary
0021 
0022 matfile = fullfile(atmlab('ATMLAB_DATA_PATH'), 'sensors', 'avhrr', 'gac_version4.mat');
0023 S = load(matfile);
0024 
0025 % add reading information to structure so this need not be done on reading
0026 % (every microsecond counts there because the function is called for every
0027 % scanline, for every field)
0028 for cat = {'head', 'line'}
0029     flds = fieldnames(S.(cat{1}));
0030     for fld = flds.';
0031         ws = S.(cat{1}).(fld{1}).Word_Size;
0032         nw = S.(cat{1}).(fld{1}).Number_of_Words;
0033         nbits = num2str(ws*8);
0034         switch S.(cat{1}).(fld{1}).Data_Type
0035             
0036             case 'i'
0037                 S.(cat{1}).(fld{1}).read_type = ['int' nbits '=>int' nbits];
0038                 S.(cat{1}).(fld{1}).read_size = nw;
0039                 S.(cat{1}).(fld{1}).cast_type = ['int' nbits];
0040             case 'u'
0041                 S.(cat{1}).(fld{1}).read_type = ['uint' nbits '=>uint' nbits];
0042                 S.(cat{1}).(fld{1}).read_size = nw;
0043                 S.(cat{1}).(fld{1}).cast_type = ['uint' nbits];                
0044             case 'c'
0045                 S.(cat{1}).(fld{1}).read_type = 'uint8=>char';
0046                 S.(cat{1}).(fld{1}).read_size = uint16(ws)*nw;
0047             case ''
0048                 % should not be read
0049                 S.(cat{1}).(fld{1}).read_type = 'uint8=>uint8';
0050                 S.(cat{1}).(fld{1}).read_size = 1;
0051             otherwise
0052                 error('atmlab:avhrr_define_gac_l1b', ...
0053                     'Field %s has unknown data type: %s', ...
0054                     fld{1}, S.(cat{1}).(fld{1}).Data_Type);
0055         end
0056     end
0057 end
0058 
0059 head = S.head;
0060 line = S.line;
0061 
0062 end

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005