Home > atmlab > deprecated > colloc_process_hirscs_poes.m

colloc_process_hirscs_poes

PURPOSE ^

colloc_process_hirscs_poes Gather collocation info to store for hirscs+MHS

SYNOPSIS ^

function M = colloc_process_hirscs_poes(collocations,~, date1, data1,~, date2, data2)

DESCRIPTION ^

 colloc_process_hirscs_poes Gather collocation info to store for hirscs+MHS

 After collocating, we want to gather information about the collocations: not
 only indices and columns, but also time, lat, long, distance, interval. This
 file collects such data.

 FORMAT

   M = colloc_process_hirscs_poes(collocations, ...
       name1, date1, data1, ...
       name2, date2, data2);

 IN

   collocations    Nx4 matrix  As returned by collocate
   name1           string      Name of primary satellite (not used here)
   date1           1x5 vector  Contains [year month day hour minute] for the
                               start of the primary granule.
   data1           structure   Fields time, lat and lon should be present; as
                               returned by datasets_constants('read_hirscs')
   name2           string      Name of secondary satellite (not used here)
   date2           1x5 vector  As date1, but for secondary granule.
   data2           structure   As data1, but for secondary granule; as
                               returned by dataset_constants('read_mhs').

 OUT

   M               Nxp matrix  Matrix containing p fields of information for
                               all N collocations.

 $Id: colloc_process_hirscs_poes.m 7553 2012-04-27 19:08:16Z gerrit $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

colloc_process_hirscs_poes.m

SOURCE CODE ^

0001 function M = colloc_process_hirscs_poes(collocations, ...
0002     ~, date1, data1, ...
0003     ~, date2, data2)
0004 
0005 % colloc_process_hirscs_poes Gather collocation info to store for hirscs+MHS
0006 %
0007 % After collocating, we want to gather information about the collocations: not
0008 % only indices and columns, but also time, lat, long, distance, interval. This
0009 % file collects such data.
0010 %
0011 % FORMAT
0012 %
0013 %   M = colloc_process_hirscs_poes(collocations, ...
0014 %       name1, date1, data1, ...
0015 %       name2, date2, data2);
0016 %
0017 % IN
0018 %
0019 %   collocations    Nx4 matrix  As returned by collocate
0020 %   name1           string      Name of primary satellite (not used here)
0021 %   date1           1x5 vector  Contains [year month day hour minute] for the
0022 %                               start of the primary granule.
0023 %   data1           structure   Fields time, lat and lon should be present; as
0024 %                               returned by datasets_constants('read_hirscs')
0025 %   name2           string      Name of secondary satellite (not used here)
0026 %   date2           1x5 vector  As date1, but for secondary granule.
0027 %   data2           structure   As data1, but for secondary granule; as
0028 %                               returned by dataset_constants('read_mhs').
0029 %
0030 % OUT
0031 %
0032 %   M               Nxp matrix  Matrix containing p fields of information for
0033 %                               all N collocations.
0034 %
0035 % $Id: colloc_process_hirscs_poes.m 7553 2012-04-27 19:08:16Z gerrit $
0036 
0037 %% prepare
0038 c = colloc_constants('cols_hirscs_poes');
0039 c = c.overlap;
0040 n = size(collocations, 1);
0041 M = nan*zeros(n, c.NCOLS);
0042 
0043 % convert to cell array for easy passing into date2unixsecs
0044 date1_cell = num2cell(date1);
0045 date2_cell = num2cell(date2);
0046 
0047 % row and column numbers
0048 i1 = collocations(:, 1);
0049 %c1 = collocations(:, 2);
0050 r2 = collocations(:, 3);
0051 c2 = collocations(:, 4);
0052     
0053 % index for direct addressing
0054 %i1 = sub2ind(size(data1.lat), r1, c1);
0055 i2 = sub2ind(size(data2.lat), r2, c2);
0056 
0057 %% store info
0058 
0059 % lat/long
0060 M(:, c.H_LAT) = data1.lat(i1);
0061 M(:, c.H_LONG) = data1.lon(i1);
0062 M(:, c.MHS_LAT) = data2.lat(i2);
0063 M(:, c.MHS_LONG) = data2.lon(i2);
0064 
0065 % time
0066 M(:, c.H_START) = round(date2unixsecs(date1_cell{1:5}));
0067 M(:, c.MHS_START) = round(date2unixsecs(date2_cell{1:5}));
0068 
0069 
0070 M(:, c.H_TIME) = data1.epoch + data1.time(i1);
0071 M(:, c.MHS_TIME) = data2.epoch + data2.time(r2);
0072 
0073 % angles
0074 M(:, c.MHS_LZA) = data2.lza;
0075 M(:, c.MHS_LAA) = data2.laa;
0076 M(:, c.SZA) = data2.sza;
0077 M(:, c.SAA) = data2.saa;
0078 
0079 % index/column
0080 M(:, c.H_I) = i1;
0081 M(:, c.MHS_ROW) = r2;
0082 M(:, c.MHS_COL) = c2;
0083 
0084 % distance and interval
0085 M(:, c.DIST) = sphdist(M(:, c.H_LAT), M(:, c.H_LONG), ...
0086     M(:, c.MHS_LAT), M(:, c.MHS_LONG), constants('EARTH_RADIUS')/1e3);
0087 M(:, c.INT) = M(:, c.MHS_TIME) - M(:, c.H_TIME);
0088 
0089 % other HIRSCS
0090 M(:, c.H_ZEN) = data1.zen(i1);
0091 M(:, c.H_ALT) = data1.alt(i1);
0092 M(:, c.H_LINE) = data1.line(i1);
0093 M(:, c.H_POSI) = data1.posi(i1);
0094 
0095 %% select only the nearest one
0096 
0097 M = sortrows(M, [c.H_I c.DIST]);
0098 [~, I_first] = unique(M(:, c.H_I), 'first');
0099 M = M(I_first, :);

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