Home > atmlab > datasets > +satreaders > avhrr.m

avhrr

PURPOSE ^

satreaders.avhrr Read AVHRR l1b data and arrange in a common format

SYNOPSIS ^

function data = avhrr(file, varargin)

DESCRIPTION ^

 satreaders.avhrr Read AVHRR l1b data and arrange in a common format

 This file reads data from a AVHRR l1b radiometer file and rearranges the
 fields to the common format, used by collocation codes.  This function is
 not meant to be called directly; use either the 'read_granule' method on
 the SatDataset avhrr, or use avhrr_gac_read.

 For info on the common format, see <a href="matlab:help SatDataset/reader">SatDataset/reader</a>.

 FORMAT

   data = satreaders.avhrr(file)

 IN

   file        string      Path to l1b file
   extra       cellstr     fields to read

 OUT

   data    struct  With fields:
                   time    time in seconds since 00:00 UT
                   lat     latitude in degrees, one column per viewing angle
                   lon     longitude in [-180, 180] degrees, colums as for lat
                   y       measurements

 See also: avhrr_gac_read, SatDataset/read

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

avhrr.m

SOURCE CODE ^

0001 function data = avhrr(file, varargin)
0002 
0003 % satreaders.avhrr Read AVHRR l1b data and arrange in a common format
0004 %
0005 % This file reads data from a AVHRR l1b radiometer file and rearranges the
0006 % fields to the common format, used by collocation codes.  This function is
0007 % not meant to be called directly; use either the 'read_granule' method on
0008 % the SatDataset avhrr, or use avhrr_gac_read.
0009 %
0010 % For info on the common format, see <a href="matlab:help SatDataset/reader">SatDataset/reader</a>.
0011 %
0012 % FORMAT
0013 %
0014 %   data = satreaders.avhrr(file)
0015 %
0016 % IN
0017 %
0018 %   file        string      Path to l1b file
0019 %   extra       cellstr     fields to read
0020 %
0021 % OUT
0022 %
0023 %   data    struct  With fields:
0024 %                   time    time in seconds since 00:00 UT
0025 %                   lat     latitude in degrees, one column per viewing angle
0026 %                   lon     longitude in [-180, 180] degrees, colums as for lat
0027 %                   y       measurements
0028 %
0029 % See also: avhrr_gac_read, SatDataset/read
0030 
0031 % $Id: avhrr.m 8720 2013-10-21 20:41:39Z gerrit $
0032 
0033 extra_fields = optargs(varargin, {{}});
0034 % this should actually be implemented as a pseudo-field...
0035 extra_fields = setdiff(extra_fields, {'flag_3_is_3A', 'y'});
0036 
0037 newfile = uncompress(file, atmlab('WORK_AREA'), struct('unidentified', 'error'));
0038 c = onCleanup(@()delete(newfile));
0039 
0040 header_fields = {'avh_h_l1bversnb'};
0041 core_fields = {'avh_scnlinbit'}; % other core fields are always returned
0042 all_fields = union(core_fields, extra_fields);
0043 superfluous_fields = setdiff(all_fields, extra_fields);
0044 
0045 data = avhrr_gac_read(newfile, header_fields, all_fields);
0046 
0047 % add file/version
0048 
0049 data.file = file;
0050 % netcdf library doesn't like uint16 attribute
0051 data.version = single(data.avh_h_l1bversnb);
0052 data.flag_3_is_3A = logical(bitand(data.avh_scnlinbit, 1));
0053 data = rmfield(data, union(header_fields, superfluous_fields));
0054 
0055 end

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