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

calipso

PURPOSE ^

SATREADERS.CALIPSO reads calipso data

SYNOPSIS ^

function [S,attr] = calipso(file, varargin)

DESCRIPTION ^

 SATREADERS.CALIPSO reads calipso data

 Read calipso caliop 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 gzipped 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  With associated attributes

 FORMAT

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

calipso.m

SOURCE CODE ^

0001 function [S,attr] = calipso(file, varargin)
0002 
0003 % SATREADERS.CALIPSO reads calipso data
0004 %
0005 % Read calipso caliop 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 gzipped 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  With associated attributes
0025 %
0026 % FORMAT
0027 %
0028 %   [S,attr] = satreaders.calipso(file, varargin)
0029 
0030 % $Id: calipso.m 8720 2013-10-21 20:41:39Z gerrit $
0031 % Created by Salomon Eliasson
0032 
0033 %% INFORMATION
0034 %
0035 % Latitude:      Three values are reported: the footprint latitude for the
0036 %                first pulse included in the 15 shot average; the footprint
0037 %                latitude for the final pulse; and the footprint latitude
0038 %                at the temporal midpoint (i.e., at the 8th of 15
0039 %                consecutive laser shots).
0040 %
0041 % Longitude:     -||-
0042 %
0043 % Profile_UTC_Time :  Time expressed in Coordinated Universal Time (UTC),
0044 %                     and formatted as 'yymmdd.ffffffff', where 'yy'
0045 %                     represents the last two digits of year, 'mm' and 'dd'
0046 %                     represent month and day, respectively, and 'ffffffff'
0047 %                     is the fractional part of the day. For the 5 km
0048 %                     layerproducts, three values are reported: the time
0049 %                     for the first pulse included in the 15 shot average;
0050 %                     the time for the final pulse; and the time at the
0051 %                     temporal midpoint (i.e., at the 8th of 15 consecutive
0052 %                     laser shots).
0053 %
0054 % ExtinctionQC_532: 0 is recommended for proper retrievals
0055 %
0056 % Ice_Water_Path: has 10 values. pressumably allowing for up to 10 clouds
0057 %
0058 core_fields = {'Latitude','Longitude','Profile_UTC_Time'};
0059 extra_fields = optargs(varargin, {{}});
0060 all_fields = [core_fields(:); extra_fields(:)];
0061 
0062 % make TEMPDIR & cleanup after I'm done.
0063 tmpdir = create_tmpfolder();
0064 cleanupObject = onCleanup(@() delete_tmpfolder(tmpdir));
0065 file = uncompress(file,tmpdir);
0066 
0067 % READ the data. This also scales the data automatically!
0068 for F = all_fields'
0069     S.(F{1})  = hdfread(file,F{1});
0070 end
0071 
0072 %% RENAME some fields
0073 
0074 % get epoch.
0075 %
0076 D = datasets;
0077 info =  D.calipso.find_info_from_granule(file);
0078 s2d = @str2double;
0079 
0080 % See information below header to make sense of this
0081 yymmdd = s2d(sprintf('%2.0f%02.0f%02.0f',s2d(info.year)-2000,s2d(info.month),s2d(info.day)));
0082 
0083 % I will only use the midway value for the core
0084 %
0085 S.lon = double(S.Longitude(:,2));
0086 S.lat = double(S.Latitude(:,2));
0087 S.time = (S.Profile_UTC_Time(:,2)-yymmdd) * (24*3600);
0088 S.epoch = round(date2unixsecs(s2d(info.year), s2d(info.month), s2d(info.day)));
0089 S.path = file;
0090 S.version = '051 (hardcoded)';
0091 
0092 S = rmfield(S,core_fields);
0093 S = MaskInvalidGeoTimedataWithNaN(S);
0094 
0095 end

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