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

collocation_cpr_mhs

PURPOSE ^

satreaders.collocation_cpr_mhs Read CPR/MHS collocation file

SYNOPSIS ^

function data = collocation_cpr_mhs(file)

DESCRIPTION ^

 satreaders.collocation_cpr_mhs Read CPR/MHS collocation file

 Read a CPR/MHS collocation file and return things in the common format.
 Additionally, all data from the collocation file are included.

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

   file        string      path to collocations file

 out

   data        structure   data with time, lat, lon


 $Id: collocation_cpr_mhs.m 8720 2013-10-21 20:41:39Z gerrit $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

collocation_cpr_mhs.m

SOURCE CODE ^

0001 function data = collocation_cpr_mhs(file)
0002 
0003 % satreaders.collocation_cpr_mhs Read CPR/MHS collocation file
0004 %
0005 % Read a CPR/MHS collocation file and return things in the common format.
0006 % Additionally, all data from the collocation file are included.
0007 %
0008 % For info on the common format, see <a href="matlab:help SatDataset/reader">SatDataset/reader</a>.
0009 % IN
0010 %
0011 %   file        string      path to collocations file
0012 %
0013 % out
0014 %
0015 %   data        structure   data with time, lat, lon
0016 %
0017 %
0018 % $Id: collocation_cpr_mhs.m 8720 2013-10-21 20:41:39Z gerrit $
0019 
0020 
0021 tmp = tempname(atmlab('WORK_AREA'));
0022 exec_system_cmd(['zcat ' file '>' tmp]); % 3x faster than gunzip
0023 %gunzipped = gunzip(file, atmlab('WORK_AREA'));
0024 %data = loadncfile(gunzipped{1});
0025 data = loadncfile(tmp);
0026 delete(tmp);
0027 data.info = data.global_attributes;
0028 
0029 data.version = ['colloc:' data.info.software_version ':' ...
0030     data.info.primary_version ':' data.info.secondary_version ':' ...
0031     data.info.date];
0032 
0033 rows = data.FIRST;
0034 data.lat = data.B_LAT(rows);
0035 data.lon = data.B_LONG(rows);
0036 
0037 % use C_TIME to calculate the epoch, but return B_TIME as we're working
0038 % with meandata here
0039 [y, mo, d, ~, ~, ~] = unixsecs2date(double(data.C_TIME(rows)));
0040 data.epoch = round(unique(date2unixsecs(y, mo, d)));
0041 assert(isempty(data.epoch)||isscalar(data.epoch), 'atmlab:satreaders.collocation_cpr_mhs', ...
0042      'Data in %s appears to contain measurement from more than one day', ...
0043      file);
0044 [~, ~, ~, h, mi, s] = unixsecs2date(double(data.B_TIME(rows)));
0045 
0046 data.time = compensate_wraparound(3600*h + 60*mi + s);
0047 data.file = file;

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