Home > atmlab > deprecated > find_granules_for_period.m

find_granules_for_period

PURPOSE ^

find_granules_for_period List all granules for sat/dataset for period

SYNOPSIS ^

function [allgrans, allpaths] = find_granules_for_period(date1, date2, sat, sensor)

DESCRIPTION ^

 find_granules_for_period List all granules for sat/dataset for period

 For the period between date1 and date2, list all granules (as vectors
 indicating the starting date/time) available.

 Valid datasets are returned by <a href="matlab:help list_datasets">list_datasets</a>.

 FORMAT

   [allgrans, allpaths] = find_granules_for_period(date1, date2, sat, dataset)

 IN

   date1   datevec     starting date
   date2   datevec     ending date
   sat     string      satellite
   dataset  string      sensor

 OUT

   allgrans matrix     all granules in daterange
   allpaths cellstr    all paths to those granules

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

find_granules_for_period.m

SOURCE CODE ^

0001 function [allgrans, allpaths] = find_granules_for_period(date1, date2, sat, sensor)
0002 
0003 % find_granules_for_period List all granules for sat/dataset for period
0004 %
0005 % For the period between date1 and date2, list all granules (as vectors
0006 % indicating the starting date/time) available.
0007 %
0008 % Valid datasets are returned by <a href="matlab:help list_datasets">list_datasets</a>.
0009 %
0010 % FORMAT
0011 %
0012 %   [allgrans, allpaths] = find_granules_for_period(date1, date2, sat, dataset)
0013 %
0014 % IN
0015 %
0016 %   date1   datevec     starting date
0017 %   date2   datevec     ending date
0018 %   sat     string      satellite
0019 %   dataset  string      sensor
0020 %
0021 % OUT
0022 %
0023 %   allgrans matrix     all granules in daterange
0024 %   allpaths cellstr    all paths to those granules
0025 %
0026 % $Id: find_granules_for_period.m 7553 2012-04-27 19:08:16Z gerrit $
0027 
0028 % FIXME: update to new-style
0029 warning(['atmlab:' mfilename], 'old style function, being phased out, use OO way');
0030 
0031 dates = daterange(date1, date2);
0032 ndates = size(dates, 1);
0033 
0034 allgrans = nan*zeros(ndates*15, 5);
0035 allpaths = cell(size(allgrans));
0036 
0037 n = 0;
0038 for i = 1:ndates
0039     date = dates(i, :);
0040     [grans, paths] = find_granules_by_date(date(1), date(2), date(3), sat, sensor, false);
0041     ngrans = size(grans, 1);
0042     allgrans(n+1:n+ngrans, :) = grans;
0043     allpaths(n+1:n+ngrans) = paths;
0044     n = n + ngrans;
0045 end
0046 
0047 to_remove = isnan(allgrans(:, 1));
0048 allgrans(to_remove, :) = [];
0049 allpaths(to_remove) = [];
0050 [allgrans, I] = sortrows(allgrans);
0051 allpaths = allpaths(I);

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