Home > atmlab > deprecated > find_datadir_by_date.m

find_datadir_by_date

PURPOSE ^

find_datadir_by_date Find directory containing granules

SYNOPSIS ^

function fulldir = find_datadir_by_date(datevec, satname, dataset)

DESCRIPTION ^

 find_datadir_by_date Find directory containing granules

 For the given datevec, satellite name and dataset, return a string with
 the path to the directory that contains the granules for this particular
 datevec.

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

 FORMAT

   fulldir = find_datadir_by_date(datevec, satname, dataset)

 IN

   datevec     vector      [year month day] etc.
   satname     string      name of sat or cellstr {sat1 sat2}
   dataset     string      name of dataset on satellite

 OUT

   fulldir     string      path to directory

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

find_datadir_by_date.m

SOURCE CODE ^

0001 function fulldir = find_datadir_by_date(datevec, satname, dataset)
0002 
0003 % find_datadir_by_date Find directory containing granules
0004 %
0005 % For the given datevec, satellite name and dataset, return a string with
0006 % the path to the directory that contains the granules for this particular
0007 % datevec.
0008 %
0009 % Valid datasets are returned by <a href="matlab:help list_datasets">list_datasets</a>.
0010 %
0011 % FORMAT
0012 %
0013 %   fulldir = find_datadir_by_date(datevec, satname, dataset)
0014 %
0015 % IN
0016 %
0017 %   datevec     vector      [year month day] etc.
0018 %   satname     string      name of sat or cellstr {sat1 sat2}
0019 %   dataset     string      name of dataset on satellite
0020 %
0021 % OUT
0022 %
0023 %   fulldir     string      path to directory
0024 %
0025 % $Id: find_datadir_by_date.m 7553 2012-04-27 19:08:16Z gerrit $
0026 
0027 % verify basedir is defined and exists
0028 
0029 warning(['atmlab:' mfilename], 'old style function, being phased out, use OO way');
0030 
0031 errid = 'atmlab:find_datadir_by_date';
0032 
0033 try
0034     basedir = datasets_config([dataset '_basedir']);
0035 catch ME
0036     switch ME.identifier
0037         case 'atmlab:input:undefined'
0038             error(errid, ...
0039                 'No basedir defined for %s, please define %s_basedir.', ...
0040                 dataset, dataset);
0041         otherwise
0042             ME.rethrow();
0043     end
0044 end
0045 assert(any(basedir), errid, 'No basedir initialised for %s', dataset);
0046 assert(exist(basedir, 'dir')~=0, 'atmlab:find_granules_by_date', ...
0047         ['Configured data directory for %s is %s, ' ...
0048          'but this does not exist or is not a directory. ' ...
0049          'Please define %s_basedir correctly ' ...
0050          'or create the directory.'], ...
0051          dataset, basedir, dataset);
0052      
0053 basedir = datasets_config([dataset '_basedir']);
0054 subdir = datasets_config([dataset '_subdir']);
0055 fulldir = fullfile(basedir, subdir);
0056 
0057 fulldir = strrep_variables(fulldir, satname, datevec);

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