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

dardar

PURPOSE ^

SATREADERS.DARDAR Read DARDAR data in the common format

SYNOPSIS ^

function S = dardar(file, varargin)

DESCRIPTION ^

 SATREADERS.DARDAR Read DARDAR data in the common format

 This file reads data from a DARDAR file and rearranges the fields to
 the common format. Geodata and time data are always retrieved from the
 data file.

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

 IN

   file    string      Path to hdf file
   extra   cell array (optional) extra fields.

 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

 FORMAT

   S = satreaders.dardar(file, varargin)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

dardar.m

SOURCE CODE ^

0001 function S = dardar(file, varargin)
0002 
0003 % SATREADERS.DARDAR Read DARDAR data in the common format
0004 %
0005 % This file reads data from a DARDAR file and rearranges the fields to
0006 % the common format. Geodata and time data are always retrieved from the
0007 % data file.
0008 %
0009 % For info on the common format, see <a href="matlab:help SatDataset/reader">SatDataset/reader</a>.
0010 %
0011 % IN
0012 %
0013 %   file    string      Path to hdf file
0014 %   extra   cell array (optional) extra fields.
0015 %
0016 % OUT
0017 %
0018 %   data    struct  With fields:
0019 %                   time    time in seconds since 00:00 UT
0020 %                   lat     latitude in degrees, one column per viewing angle
0021 %                   lon     longitude in [-180, 180] degrees, colums as for lat
0022 %
0023 % FORMAT
0024 %
0025 %   S = satreaders.dardar(file, varargin)
0026 
0027 % $Id: dardar.m 8720 2013-10-21 20:41:39Z gerrit $
0028 % Created by Salomon Eliasson
0029 
0030 core_fields   = {'time','latitude','longitude'};
0031 extra_fields  = optargs(varargin, {{}});
0032 all_fields    = [core_fields(:); extra_fields(:)];
0033 
0034 for F = all_fields'
0035     S.(F{1}) = hdfread(file,F{1});
0036     if isvector(S.(F{1})) && ~iscolumn(S.(F{1})) && length(S.(F{1})) == length(S.time)
0037         S.(F{1}) = S.(F{1}).';
0038     end
0039 end
0040 
0041 
0042 % CONSTRUCT time axis with same dimensions
0043 S.lat = double(S.latitude);
0044 S.lon = double(S.longitude);
0045 S.time = double(S.time);
0046 
0047 % get the verion directly from the filename
0048 D = datasets;
0049 info = D.dardar.find_info_from_granule(file);
0050 date = dayofyear_inverse(str2double(info.year), str2double(info.doy));
0051 S.epoch = round(date2unixsecs(date.year, date.month, date.day));
0052 
0053 S.version = info.version;
0054 S.path = file;
0055 
0056 S = rmfield(S,{'latitude','longitude'});
0057 
0058 S = MaskInvalidGeoTimedataWithNaN(S);
0059 
0060 end

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