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

mspps

PURPOSE ^

SATREADERS.MSPPS reads mspps data

SYNOPSIS ^

function S = mspps(file, varargin)

DESCRIPTION ^

 SATREADERS.MSPPS reads mspps data

 Read MSPPS data and output the data in the format common to all
 satreaders.<dataset>.m readers in atmlab. 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
                   fields  and what ever extra fields you wanted

   attr    struct  empty

 FORMAT

   [S,attr] = satreaders.mspps(file, varargin)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

mspps.m

SOURCE CODE ^

0001 function S = mspps(file, varargin)
0002 
0003 % SATREADERS.MSPPS reads mspps data
0004 %
0005 % Read MSPPS data and output the data in the format common to all
0006 % satreaders.<dataset>.m readers in atmlab. Geodata and time data are
0007 % always retrieved from the 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 %                   fields  and what ever extra fields you wanted
0023 %
0024 %   attr    struct  empty
0025 %
0026 % FORMAT
0027 %
0028 %   [S,attr] = satreaders.mspps(file, varargin)
0029 
0030 % $Id: mspps.m 8720 2013-10-21 20:41:39Z gerrit $
0031 % Created by Salomon Eliasson
0032 
0033 %% INFORMATION
0034 % Time : (TAI93) Number of seconds and fractions since 0000 Jan. 1, 1993
0035 
0036 core_fields = {'Latitude','Longitude','Time'};
0037 extra_fields = optargs(varargin, {{}});
0038 all_fields = [core_fields(:); extra_fields(:)];
0039 
0040 for F = all_fields'
0041     try
0042     S.(F{1}) = hdfread(file,F{1});
0043     catch ME
0044         if strcmp(ME.identifier,'MATLAB:imagesci:hdfread:noDataSets')
0045             fprintf(2,'Dataset: %s is missing from file. skipping...\n',F{1})
0046         end
0047         if any(strcmp(ME.identifier,{...
0048                 'MATLAB:imagesci:hdfquickinfo:invalidFile',...
0049                 'MATLAB:imagesci:hdfinfo:invalidFile',...
0050                 'MATLAB:imagesci:hdfread:noDataSets'}))
0051             error('atmlab:invalid_data','"%s:%s" for file: %s',...
0052                 ME.identifier,ME.message,mfilename)
0053         else
0054             error(ME.identifier,ME.message)
0055         end
0056     end
0057 end
0058 
0059 %% RENAME some fields
0060 
0061 S.lat = double(S.Latitude);
0062 S.lon = double(S.Longitude);
0063 
0064 % get epoch.
0065 %
0066 D = datasets;
0067 info = D.mspps.find_info_from_granule(file);
0068 s2d = @str2double;
0069 S.epoch = round(date2unixsecs(s2d(info.year), s2d(info.month), s2d(info.day)));
0070 
0071 % See information below header to make sense of this
0072 S.time = S.Time{1}(:)-( S.epoch-date2unixsecs(1993,1,1) );
0073 
0074 S.path = file;
0075 S.version = 'unknown';
0076 
0077 S = rmfield(S,core_fields);
0078 S = MaskInvalidGeoTimedataWithNaN(S);
0079 
0080 end

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