Home > atmlab > datasets > dardarsub_postprocessor.m

dardarsub_postprocessor

PURPOSE ^

% dardarsub_postprocessor

SYNOPSIS ^

function S = dardarsub_postprocessor(self,S,fields)

DESCRIPTION ^

% dardarsub_postprocessor


 PURPOSE: To create "pseudo" fields that are not in the original dardarsub
          data by post-processing fields that are in the original data


 IN
     self = dataset
     S = Data structure to add pseudo field to (from self.reader)
     fields = {'names','of','pseudo','fields'}

 OUT
     S = Data structure + pseudo field/s

 NOTE: See also help Satdataset/pseudo_fields

 $Id: dardarsub_postprocessor.m 8433 2013-05-22 13:29:28Z seliasson $
 Salomon Eliasson

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

dardarsub_postprocessor.m

SOURCE CODE ^

0001 function S = dardarsub_postprocessor(self,S,fields)
0002 %% dardarsub_postprocessor
0003 %
0004 %
0005 % PURPOSE: To create "pseudo" fields that are not in the original dardarsub
0006 %          data by post-processing fields that are in the original data
0007 %
0008 %
0009 % IN
0010 %     self = dataset
0011 %     S = Data structure to add pseudo field to (from self.reader)
0012 %     fields = {'names','of','pseudo','fields'}
0013 %
0014 % OUT
0015 %     S = Data structure + pseudo field/s
0016 %
0017 % NOTE: See also help Satdataset/pseudo_fields
0018 %
0019 % $Id: dardarsub_postprocessor.m 8433 2013-05-22 13:29:28Z seliasson $
0020 % Salomon Eliasson
0021 
0022 % column integrate
0023 % use dependent fields to BUILD the pseudo field. maybe transpose to get
0024 % the right orientation
0025 
0026 narginchk(3,3)
0027 
0028 if isfield(S,'HEIGHT')
0029     S.HEIGHT = repmat(S.HEIGHT,size(S.iwc,1),1);
0030 end
0031     
0032 for F = fields
0033     field = F{1};
0034     mv = self.pseudo_fields.(field).atts.missing_value;
0035     switch field
0036         case 'dardar_IWP'
0037             
0038             S.dardar_IWP = column_integrate(S,{'iwc','HEIGHT'})';
0039             S.dardar_IWP(isnan(S.dardar_IWP))=mv;
0040         case 'dardar_ln_IWP_error'
0041             
0042             % iwc_max = exp(ln(iwc)+ln_iwc_error)
0043             %          = exp(ln(iwc)) * exp(ln_iwc_error)
0044             %         = iwc * exp(ln_iwc_error)
0045             
0046             %
0047             % As in eliasson13:_systematic_jgr Sect. 4.1
0048             % This is assumed OK:
0049             %
0050             % ln(IWP^+/IWP_0) \approx ln(IWP_0/IWP_-)
0051             % therefore
0052             % \sigma_{IWP}=\frac{ln(\frac{IWP^+}{IWP^-})}{2}
0053             
0054             IWP_plus = column_integrate(catstruct(S,struct('maxError',S.iwc.*exp(S.ln_iwc_error))),{'maxError','HEIGHT'})';
0055             IWP_minus = column_integrate(catstruct(S,struct('minError',S.iwc.*exp(-S.ln_iwc_error))),{'minError','HEIGHT'})';
0056             
0057             S.dardar_ln_IWP_error = log(IWP_plus./IWP_minus)/2;
0058             S.dardar_ln_IWP_error(isnan(S.dardar_ln_IWP_error))=mv;
0059     end
0060 end
0061 
0062 end

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