Home > atmlab > deprecated > colloc_process_meandata_collocation_cpr_poes_avhrr.m

colloc_process_meandata_collocation_cpr_poes_avhrr

PURPOSE ^

colloc_process_meandata_collocation_cpr_poes_avhrr Get averaged info

SYNOPSIS ^

function M_m = colloc_process_meandata_collocation_cpr_poes_avhrr(collocations, M_c, M_d,name1, date1, data1,name2, date2, data2)

DESCRIPTION ^

 colloc_process_meandata_collocation_cpr_poes_avhrr Get averaged info

 Considering collocations along with collocation data, get averaged
 AVHRR information per MHS pixel.

 Because this function has the same format as other
 colloc_process_meandata_*, some of the arguments are ignored.

 FORMAT

   M = process_meandata_collocation_cpr_poes_avhrr(collocations, M_coll, M_data, ...
       date1, data1, date2, data2)

 IN

   collocations    matrix      As returned by collocate
   M_coll          matrix      As returned by process_cpr_mhs
   M_data          matrix      As returned by process_data_cpr_mhs
   name1           string      name of satellite 1
   date1           1x5 vector  Contains [year month day hour minute] for the
                               start of the primary granule
   data1           structure   Fields for brightness temperature should be
                               present
   name2           string      name of satellite 2
   date2           1x5 vector  As date1, but for secondary granule
   data2           structure   As data1, but for secondary granule.

 OUT

   M_m     matrix  Containing averaged data.

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

colloc_process_meandata_collocation_cpr_poes_avhrr.m

SOURCE CODE ^

0001 function M_m = colloc_process_meandata_collocation_cpr_poes_avhrr(collocations, M_c, M_d, ...
0002     name1, date1, data1, ...
0003     name2, date2, data2)
0004 
0005 % colloc_process_meandata_collocation_cpr_poes_avhrr Get averaged info
0006 %
0007 % Considering collocations along with collocation data, get averaged
0008 % AVHRR information per MHS pixel.
0009 %
0010 % Because this function has the same format as other
0011 % colloc_process_meandata_*, some of the arguments are ignored.
0012 %
0013 % FORMAT
0014 %
0015 %   M = process_meandata_collocation_cpr_poes_avhrr(collocations, M_coll, M_data, ...
0016 %       date1, data1, date2, data2)
0017 %
0018 % IN
0019 %
0020 %   collocations    matrix      As returned by collocate
0021 %   M_coll          matrix      As returned by process_cpr_mhs
0022 %   M_data          matrix      As returned by process_data_cpr_mhs
0023 %   name1           string      name of satellite 1
0024 %   date1           1x5 vector  Contains [year month day hour minute] for the
0025 %                               start of the primary granule
0026 %   data1           structure   Fields for brightness temperature should be
0027 %                               present
0028 %   name2           string      name of satellite 2
0029 %   date2           1x5 vector  As date1, but for secondary granule
0030 %   data2           structure   As data1, but for secondary granule.
0031 %
0032 % OUT
0033 %
0034 %   M_m     matrix  Containing averaged data.
0035 %
0036 % $Id: colloc_process_meandata_collocation_cpr_poes_avhrr.m 7553 2012-04-27 19:08:16Z gerrit $
0037 
0038 c = colloc_constants('cols_collocation_cpr_mhs_avhrr');
0039 
0040 % find unique ones
0041 
0042 [uniques, firsts] = unique(M_c(:, c.overlap.CPR_MHS_MEAN_ROW), 'rows', 'first');
0043 lasts = [firsts(2:end)-1; size(M_c, 1)];
0044 
0045 M_m = nan*zeros(size(uniques, 1), c.meandata.NCOLS);
0046 
0047 
0048 j = 0; % counter increases only when there is data
0049 for i = 1:size(uniques, 1) % need to be done in loop due to mean/std/etc.
0050     first = firsts(i);
0051     last = lasts(i);
0052     M_c_part = M_c(first:last, :);
0053     M_d_part = M_d(first:last, :);
0054     AVHRR_in_MHS = M_c_part(:, c.overlap.DIST_MHS_AVHRR) < colloc_config('distance_for_average_MHS');
0055     % put flags to nan
0056     temps = M_d_part(:, c.data.AVHRR);
0057     flagged = temps < 0 | isnan(temps);
0058     flagged_measurement = all(flagged, 2); % all channels flagged
0059     if all(flagged_measurement | ~AVHRR_in_MHS) % don't bother, all are flagged
0060         continue
0061     end
0062     
0063     % put flags to nan
0064     temps(flagged) = nan;
0065     M_d_part(:, c.data.AVHRR) = temps;
0066     
0067     fine = repmat(AVHRR_in_MHS, [1 6]) & ~flagged;
0068     
0069     j = j + 1;
0070     M_m(j, c.meandata.FIRST) = first;
0071     M_m(j, c.meandata.LAST) = last;
0072     M_m(j, c.meandata.NO) = sum(fine);
0073     M_m(j, c.meandata.MEAN) = ignoreNaN(M_d_part(:, c.data.AVHRR), @mean, 1);
0074     M_m(j, c.meandata.SD) = ignoreNaN(M_d_part(:, c.data.AVHRR), @std, 1);
0075 end
0076 
0077 rest = isnan(M_m(:, 1));
0078 M_m(rest, :) = [];

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