Home > atmlab > deprecated > write_collocations.m

write_collocations

PURPOSE ^

write_collocations Write collocation data to file

SYNOPSIS ^

function write_collocations(year, month, day, S, D, M,sat1, sensor1, ~, sensor2)

DESCRIPTION ^

 write_collocations Write collocation data to file

 Write collocation data for year/month/day in structure S to a filename. The
 filename is determined from the satellite and sensors used. Needs from

 FORMAT
   
   write_collocations(year, month, day, S, sat1, sensor1, sat2, sensor2)

 IN

   year    (numeric)   Year for which S contains collocations
   month   (numeric)   Month for which S contains collocations
   day     (numeric)   Day for which S contains collocations
   S       structure   As returned by collocate_date, structure whose
                       field(s) describe the collocations between the sensors
                       in question. (-1 means none)
   D       structure   As returned by collocate_date, for the data (-1=none)
   M       structure   As returned by collocate_date, for the mean data
                       (-1 means none)
   sat1    string      Primary satellite under consideration
   sensor1 string      Sensor at primary satellite
   sat2    string      Secondary satellite under consideration
   sensor2 string      Sensor at secondary satellite.

 OUT

   none (but writes a file)

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

write_collocations.m

SOURCE CODE ^

0001 function write_collocations(year, month, day, S, D, M, ...
0002     sat1, sensor1, ~, sensor2)
0003 
0004 % write_collocations Write collocation data to file
0005 %
0006 % Write collocation data for year/month/day in structure S to a filename. The
0007 % filename is determined from the satellite and sensors used. Needs from
0008 %
0009 % FORMAT
0010 %
0011 %   write_collocations(year, month, day, S, sat1, sensor1, sat2, sensor2)
0012 %
0013 % IN
0014 %
0015 %   year    (numeric)   Year for which S contains collocations
0016 %   month   (numeric)   Month for which S contains collocations
0017 %   day     (numeric)   Day for which S contains collocations
0018 %   S       structure   As returned by collocate_date, structure whose
0019 %                       field(s) describe the collocations between the sensors
0020 %                       in question. (-1 means none)
0021 %   D       structure   As returned by collocate_date, for the data (-1=none)
0022 %   M       structure   As returned by collocate_date, for the mean data
0023 %                       (-1 means none)
0024 %   sat1    string      Primary satellite under consideration
0025 %   sensor1 string      Sensor at primary satellite
0026 %   sat2    string      Secondary satellite under consideration
0027 %   sensor2 string      Sensor at secondary satellite.
0028 %
0029 % OUT
0030 %
0031 %   none (but writes a file)
0032 %
0033 % $Id$
0034 
0035 error('NEEDS REPLACEMENT');
0036 getfn = colloc_config(['filename_' sensor1 '_' sensor2]);
0037 
0038 % number of different datasets
0039 
0040 no = sum(cellfun(@isstruct, {S, M, D}));
0041 
0042 fields = fieldnames(S);
0043 for i = 1:length(fields)
0044     satname = fields{i};
0045     [C{1:no}] = getfn(year, month, day, sat1, satname);
0046     
0047     if ~exist(fileparts(C{1}), 'dir')
0048         logtext(colloc_config('stdout'), 'Creating %s\n', fileparts(C{1}));
0049         mkdir(fileparts(C{1}));
0050     end
0051     
0052     if ~isequal(S, -1)
0053         collocations = S.(satname);
0054         logtext(colloc_config('stdout'), 'Writing %s\n', C{1});
0055         save(C{1}, 'collocations');
0056     end
0057     if ~isequal(D, -1)
0058         data = D.(satname);
0059         logtext(colloc_config('stdout'), 'Writing %s\n', C{2});
0060         save(C{2}, 'data');
0061     end
0062     if ~isequal(M, -1)
0063         data_averaged = M.(satname);
0064         logtext(colloc_config('stdout'), 'Writing %s\n', C{3});
0065         save(C{3}, 'data_averaged');
0066     end
0067 end

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