Home > atmlab > deprecated > colloc_process_meandata_cpr_mhs.m

colloc_process_meandata_cpr_mhs

PURPOSE ^

colloc_process_meandata_cpr_mhs Get averaged CPR per MHS pixel

SYNOPSIS ^

function M = colloc_process_meandata_cpr_mhs(~, M_coll, M_data, ~, ~, ~, ~)

DESCRIPTION ^

 colloc_process_meandata_cpr_mhs Get averaged CPR per MHS pixel

 Considering collocations along with collocation data, get averaged
 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_cpr_mhs(collocations, M_coll, M_data, ...
       date1, data1, date2, data2)

 IN

   (ignored)
   M_coll  matrix  As returned by process_cpr_mhs
   M_data  matrix  As returned by process_data_cpr_mhs

 OUT

   M       matrix  Containing averaged data.

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

colloc_process_meandata_cpr_mhs.m

SOURCE CODE ^

0001 function M = colloc_process_meandata_cpr_mhs(~, M_coll, M_data, ~, ~, ~, ~)
0002 
0003 % colloc_process_meandata_cpr_mhs Get averaged CPR per MHS pixel
0004 %
0005 % Considering collocations along with collocation data, get averaged
0006 % information per MHS pixel.
0007 %
0008 % Because this function has the same format as other
0009 % colloc_process_meandata_*, some of the arguments are ignored.
0010 %
0011 % FORMAT
0012 %
0013 %   M = process_meandata_cpr_mhs(collocations, M_coll, M_data, ...
0014 %       date1, data1, date2, data2)
0015 %
0016 % IN
0017 %
0018 %   (ignored)
0019 %   M_coll  matrix  As returned by process_cpr_mhs
0020 %   M_data  matrix  As returned by process_data_cpr_mhs
0021 %
0022 % OUT
0023 %
0024 %   M       matrix  Containing averaged data.
0025 %
0026 % $Id$
0027 
0028 c = colloc_constants('cols_cpr_mhs');
0029 
0030 % find unique ones
0031 
0032 [uniques, firsts] = unique(M_coll(:, [c.overlap.B_TIME c.overlap.B_C]), 'rows', 'first');
0033 lasts = [firsts(2:end)-1; size(M_coll, 1)];
0034 
0035 M = nan*zeros(size(uniques, 1), c.meandata.NCOLS);
0036 
0037 j = 0; % counter increases only when there is data
0038 for i = 1:size(uniques, 1) % need to be done in loop due to mean/std/etc.
0039     first = firsts(i);
0040     last = lasts(i);
0041     M_coll_part = M_coll(first:last, :);
0042     M_data_part = M_data(first:last, :);
0043     CS_in_MHS = M_coll_part(:, c.overlap.B_DIST) < colloc_config('distance_for_average_MHS');
0044     CS_in_HIRS = M_coll_part(:, c.overlap.H_DIST) < colloc_config('distance_for_average_HIRS');
0045     flagged = M_data_part(:, c.data.ROIWP) < 0;
0046     
0047     if all(flagged | ~CS_in_MHS) % don't bother, all are flagged
0048         continue
0049     end
0050     
0051     fine = CS_in_MHS & ~flagged;
0052     
0053     j = j + 1;
0054     M(j, c.meandata.FIRST) = first;
0055     M(j, c.meandata.LAST) = last;
0056     M(j, c.meandata.NO) = sum(fine);
0057     M(j, c.meandata.MEAN) = mean(M_data_part(fine, c.data.ROIWP));
0058     M(j, c.meandata.SD) = std(M_data_part(fine, c.data.ROIWP));
0059     M(j, c.meandata.CV) = M(j, c.meandata.SD) ./ M(j, c.meandata.MEAN);
0060     M(j, c.meandata.FRAC) = sum(M_data_part(fine, c.data.ROIWP)>0) / M(j, c.meandata.NO);
0061     M(j, c.meandata.INHIRS) = sum(fine&CS_in_HIRS);
0062 end
0063 
0064 rest = isnan(M(:, 1));
0065 M(rest, :) = [];

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