Home > atmlab > deprecated > colloc_select_good_lines.m

colloc_select_good_lines

PURPOSE ^

colloc_select_good_lines Select 'good' scanlines

SYNOPSIS ^

function good = colloc_select_good_lines(unisec, line, sat, sensor)

DESCRIPTION ^

 colloc_select_good_lines Select 'good' scanlines

 This collocation-selector, to be used with collocation_read
 returns true for each row where the scanline does not occur
 in the swath before. For the first granule in the data,
 it returns true for every scanline.

 Assumes first row belongs to first swath.

 FORMAT

   good = colloc_select_good_lines(unisec, line, sat, sensor)

 IN

   unisec  array   contains starting times for granule for each row
   line    array   contains row-number/scanline for each granule
   sat     string  satellite
   sensor  string  satellite

 OUT

   good    logical array  true/false

 Note: this function is normally not called directly, but called by
 collocation_read.

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

colloc_select_good_lines.m

SOURCE CODE ^

0001 function good = colloc_select_good_lines(unisec, line, sat, sensor)
0002 
0003 % colloc_select_good_lines Select 'good' scanlines
0004 %
0005 % This collocation-selector, to be used with collocation_read
0006 % returns true for each row where the scanline does not occur
0007 % in the swath before. For the first granule in the data,
0008 % it returns true for every scanline.
0009 %
0010 % Assumes first row belongs to first swath.
0011 %
0012 % FORMAT
0013 %
0014 %   good = colloc_select_good_lines(unisec, line, sat, sensor)
0015 %
0016 % IN
0017 %
0018 %   unisec  array   contains starting times for granule for each row
0019 %   line    array   contains row-number/scanline for each granule
0020 %   sat     string  satellite
0021 %   sensor  string  satellite
0022 %
0023 % OUT
0024 %
0025 %   good    logical array  true/false
0026 %
0027 % Note: this function is normally not called directly, but called by
0028 % collocation_read.
0029 %
0030 % $Id: colloc_select_good_lines.m 7553 2012-04-27 19:08:16Z gerrit $
0031 
0032 [unisec_uni, I] = unique(unisec, 'first');
0033 ngrans = length(unisec_uni);
0034 
0035 good = false(size(line));
0036 cutoffs = zeros(size(unisec_uni));
0037 for i = 1:ngrans
0038     try            
0039         cutoffs(i) = granule_first_line(sat, sensor, unisec_uni(i));
0040     catch ME
0041         % ugly hack necessary because colloc_process_* add 1 second to
0042         % unisecs. This is being phased out, but still present. FIXME when
0043         % I that ugliness is gone and lost forever.
0044         switch ME.identifier
0045             case 'atmlab:granule_first_line'
0046                 cutoffs(i) = granule_first_line(sat, sensor, unisec_uni(i)-1);
0047             otherwise
0048                 ME.rethrow();
0049         end
0050     end
0051 end
0052 
0053 % make a poor estimate for those where it's unknown (average of rest)
0054 cutoffs(cutoffs==-1) = round(mean(cutoffs(cutoffs~=-1)));
0055 
0056 for i = 1:ngrans
0057     first = I(i);
0058     if i==ngrans
0059         last = length(line);
0060     else
0061         last = I(i+1)-1;
0062     end
0063     good(first:last) = line(first:last) >= cutoffs(i);
0064 end

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