Home > atmlab > datasets > +satreaders > dardarsub.m

dardarsub

PURPOSE ^

read dardarsub data

SYNOPSIS ^

function S = dardarsub(file, varargin)

DESCRIPTION ^

 read dardarsub data

 format as other satreaders.-functions.
 For info on the common format, see <a href="matlab:help SatDataset/reader">SatDataset/reader</a>.

 NOTE: This function only reads the sub selected data saved as netcdf
 on our servers. For regular DARDAR data use satreaders.dardar

 $Id: dardarsub.m 8720 2013-10-21 20:41:39Z gerrit $
 Salomon Eliasson

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

dardarsub.m

SOURCE CODE ^

0001 function S = dardarsub(file, varargin)
0002 % read dardarsub data
0003 %
0004 % format as other satreaders.-functions.
0005 % For info on the common format, see <a href="matlab:help SatDataset/reader">SatDataset/reader</a>.
0006 %
0007 % NOTE: This function only reads the sub selected data saved as netcdf
0008 % on our servers. For regular DARDAR data use satreaders.dardar
0009 %
0010 % $Id: dardarsub.m 8720 2013-10-21 20:41:39Z gerrit $
0011 % Salomon Eliasson
0012 
0013 core_fields   = {'time','lat','lon'};
0014 extra_fields  = optargs(varargin, {{}});
0015 all_fields    = [core_fields(:); extra_fields(:)];
0016 
0017 % HEIGHT
0018 % If height is needed, generate it separately since it is not in datafile
0019 if ismember('HEIGHT',all_fields)
0020     wantH=true; all_fields = all_fields(~ismember(all_fields,'HEIGHT'));
0021 else wantH=false;
0022 end
0023 
0024 [S,~,attr] = loadncvar(file, all_fields );
0025 
0026 % -----------
0027 % Add offsets and scale the data if this is provided
0028 for F = fieldnames(S)'
0029     if isfield(attr.(F{1}),'scale_factor')
0030         S.(F{1}) = (S.(F{1})*double(attr.(F{1}).scale_factor))+ ...
0031             double(attr.(F{1}).add_offset);
0032     end
0033 end
0034 
0035 D = datasets;
0036 if wantH
0037     S.HEIGHT = D.dardarsub.metadata.height;
0038 end
0039 
0040 
0041 % get additional stuff
0042 info = D.dardarsub.find_info_from_granule(file);
0043 
0044 date = dayofyear_inverse(str2double(info.year), str2double(info.doy));
0045 S.epoch = round(date2unixsecs(date.year, date.month, date.day));
0046 
0047 
0048 S.path = file;
0049 S.version = info.version;
0050 
0051 if isfield(S,'height')
0052     logtext(1,'Saving memory: extracting height vector from repetitive height matrix...\n')
0053     S.height = S.height(:,1);
0054 end
0055 
0056 S = MaskInvalidGeoTimedataWithNaN(S);
0057 end

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