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

hirscs

PURPOSE ^

satreaders.hirscs Read HIRSCS data in the common format (see README)

SYNOPSIS ^

function data = hirscs(file)

DESCRIPTION ^

 satreaders.hirscs Read HIRSCS data in the common format (see README)

 This file reads data from a HIRSCS radiometer file and rearranges the
 fields to the common format. See README.

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

 FORMAT

   data = satreaders.hirscs(file)

 IN

   file        string      Path to l1b file
   channels    vector      vector of channels to read (defaults to 1:5)

 OUT

   data    struct  With fields:
                   time    time in seconds since 00:00 UT
                   lat     latitude in degrees
                   lon     longitude in [-180, 180] degrees

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

hirscs.m

SOURCE CODE ^

0001 function data = hirscs(file)
0002 
0003 % satreaders.hirscs Read HIRSCS data in the common format (see README)
0004 %
0005 % This file reads data from a HIRSCS radiometer file and rearranges the
0006 % fields to the common format. See README.
0007 %
0008 % For info on the common format, see <a href="matlab:help SatDataset/reader">SatDataset/reader</a>.
0009 %
0010 % FORMAT
0011 %
0012 %   data = satreaders.hirscs(file)
0013 %
0014 % IN
0015 %
0016 %   file        string      Path to l1b file
0017 %   channels    vector      vector of channels to read (defaults to 1:5)
0018 %
0019 % OUT
0020 %
0021 %   data    struct  With fields:
0022 %                   time    time in seconds since 00:00 UT
0023 %                   lat     latitude in degrees
0024 %                   lon     longitude in [-180, 180] degrees
0025 
0026 % $Id: hirscs.m 8720 2013-10-21 20:41:39Z gerrit $
0027 % Gerrit Holl
0028 
0029 tmpdir = create_tmpfolder();
0030 cleanupObject = onCleanup(@() delete_tmpfolder(tmpdir));
0031 file = uncompress(file,tmpdir);
0032 
0033 ncid = netcdf.open(file, 'NC_NOWRITE');
0034 
0035 [~, nvars] = netcdf.inq(ncid);
0036 for i = 0:nvars-1
0037     nm = netcdf.inqVar(ncid, i);
0038     data.(nm) = netcdf.getVar(ncid, i, 'double');
0039 end
0040 netcdf.close(ncid);
0041 
0042 % wrap longitudes
0043 
0044 data.lon = wrapTo180(data.lon);
0045 
0046 % rotate bt, lc
0047 
0048 data.bt = data.bt.';
0049 data.lc = data.lc.';
0050 
0051 % compensate time wrapping around
0052 
0053 data.time = compensate_wraparound(data.time);
0054 
0055 % get rid of doubles. FIXME: use scanline numbers
0056 
0057 [~, I] = unique([data.time data.lat data.lon], 'rows');
0058 allfields = fieldnames(data);
0059 for i = 1:length(allfields);
0060     field = allfields{i};
0061     data.(field) = data.(field)(I, :);
0062 end

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