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

saphir

PURPOSE ^

read saphir data in the common format

SYNOPSIS ^

function S = saphir(file, varargin)

DESCRIPTION ^

 read saphir data in the common format

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

 FIXME DOC

 See also: SatDataset/reader

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

saphir.m

SOURCE CODE ^

0001 function S = saphir(file, varargin)
0002 
0003 % read saphir data in the common format
0004 %
0005 % For info on the common format, see <a href="matlab:help SatDataset/reader">SatDataset/reader</a>.
0006 %
0007 % FIXME DOC
0008 %
0009 % See also: SatDataset/reader
0010 
0011 core_fields = {'ScanTimestart', 'LatScan', 'LonScan'};
0012 extra_fields  = optargs(varargin, {{}});
0013 all_fields    = [core_fields(:); extra_fields(:)];
0014 
0015 data = read_saphir_l1(file, all_fields, 'l1a2');
0016 
0017 % need to rotate lat and lon
0018 S.lat = data.data.LatScan.';
0019 S.lon = data.data.LonScan.';
0020 
0021 % lon is in [0 360], convert to [-180, 180]
0022 S.lon = shift_longitudes(S.lon, -180, 180);
0023 
0024 % interpret time strings
0025 tmsm = cell2mat(data.data.ScanTimestart);
0026 tt = textscan(tmsm(:, 1:21).', '%4d%2d%2d %2d%2d%2d%6d');
0027 dv = double(horzcat(tt{:})); % need to convert to double for date2unixsecs
0028 
0029 S.epoch = round(date2unixsecs(dv(1, 1), dv(1, 2), dv(1, 3), ...
0030             dv(1, 4), dv(1, 5), dv(1, 6)));
0031 S.time = date2unixsecs(dv(:, 1), dv(:, 2), dv(:, 3), ...
0032             dv(:, 4), dv(:, 5), dv(:, 6)) - S.epoch;
0033 
0034 wrong_way = {'TbCh1', 'TbCh2', 'TbCh3', 'TbCh4', 'TbCh5', 'TbCh6', 'IncidencAngle'};
0035 % copy over extra fields
0036 for i = 1:length(extra_fields)
0037     S.(extra_fields{i}) = data.data.(extra_fields{i});
0038     if any(strcmp(extra_fields{i}, wrong_way))
0039         S.(extra_fields{i}) = S.(extra_fields{i}).';
0040     end
0041         
0042 end
0043 
0044 end

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