Home > atmlab > arts > qarts_abs_species.m

qarts_abs_species

PURPOSE ^

QARTS_ABS_SPECIES Adds an absorption species to the Q and SX structures

SYNOPSIS ^

function [Q,SX] =qarts_abs_species(Q,tags,nonlin,do_j,SX,D,grids,unit,method,dx)

DESCRIPTION ^

 QARTS_ABS_SPECIES   Adds an absorption species to the Q and SX structures

    The method modifies the fields ABS_SPECIES, ABS_NLS and J.ABS_SPECIES.
    The field ATMOSPHERE_DIM must be set.

    Example on adding a species, without jacobians:
       Q = qarts_abs_species( Q, {'H2O-PWR93'}, 1 );

    With jacobians:
       [Q,SX] = qarts_gas_species( Q,{'O2-PWR98'},0,1,SX,D,p_grid,'vmr');

 FORMAT   [Q,SX] = q_abs_species( Q, tags [, nonlin, do_j, SX, D, grids, unit, 
                                                            method, dx ] )
        
 OUT   Q          Modified Q structure.
       SX         Modified SX structure.
 IN    Q          Original Q structure.
       tags       Tag names as cell string array.
 OPT   nonlin     Boolean for including as "non-liner" in absorption
                  look-up table. Default is 0.
       do_j       Flag to do jacobians. Default is 0. If 0, the variables
                  below are not needed.
       SX         Original SX structure.
       D          Covariance definition. See *arts_covmat*.
       grids      Retrieval grids, as an ArrayOfVector. 
       unit       Retrieval unit ('rel', 'vmr' or 'nd'). Default is 'rel'.
       method     Calculation method ('analytical' or 'perturbation').
                  Default is 'analytical'.
       dx         Size of perturbations. Ignored if *method* = 'analytical'.
                  Default is 0.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

qarts_abs_species.m

SOURCE CODE ^

0001 % QARTS_ABS_SPECIES   Adds an absorption species to the Q and SX structures
0002 %
0003 %    The method modifies the fields ABS_SPECIES, ABS_NLS and J.ABS_SPECIES.
0004 %    The field ATMOSPHERE_DIM must be set.
0005 %
0006 %    Example on adding a species, without jacobians:
0007 %       Q = qarts_abs_species( Q, {'H2O-PWR93'}, 1 );
0008 %
0009 %    With jacobians:
0010 %       [Q,SX] = qarts_gas_species( Q,{'O2-PWR98'},0,1,SX,D,p_grid,'vmr');
0011 %
0012 % FORMAT   [Q,SX] = q_abs_species( Q, tags [, nonlin, do_j, SX, D, grids, unit,
0013 %                                                            method, dx ] )
0014 %
0015 % OUT   Q          Modified Q structure.
0016 %       SX         Modified SX structure.
0017 % IN    Q          Original Q structure.
0018 %       tags       Tag names as cell string array.
0019 % OPT   nonlin     Boolean for including as "non-liner" in absorption
0020 %                  look-up table. Default is 0.
0021 %       do_j       Flag to do jacobians. Default is 0. If 0, the variables
0022 %                  below are not needed.
0023 %       SX         Original SX structure.
0024 %       D          Covariance definition. See *arts_covmat*.
0025 %       grids      Retrieval grids, as an ArrayOfVector.
0026 %       unit       Retrieval unit ('rel', 'vmr' or 'nd'). Default is 'rel'.
0027 %       method     Calculation method ('analytical' or 'perturbation').
0028 %                  Default is 'analytical'.
0029 %       dx         Size of perturbations. Ignored if *method* = 'analytical'.
0030 %                  Default is 0.
0031 
0032 % 2005-06-23   Created by Patrick Eriksson.
0033 
0034 
0035 function [Q,SX] = ...
0036                 qarts_abs_species(Q,tags,nonlin,do_j,SX,D,grids,unit,method,dx)
0037 
0038 
0039 if nargin < 2  |  ( nargin > 2  &  nargin < 5 )
0040   error('Number of input arguments must = 2 or >= 6.');
0041 end
0042 
0043 %= Set defaults
0044 %
0045 nonlin_DEFAULT = 0;
0046 do_j_DEFAULT   = 0;
0047 unit_DEFAULT   = 'rel';
0048 method_DEFAULT = 'analytical';
0049 dx_DEFAULT     = 0;
0050 %
0051 set_defaults;
0052 
0053 
0054 %= Check input
0055 %
0056 rqre_datatype( tags, {@iscellstr} );                                       %&%
0057 rqre_datatype( do_j, {@isboolean} );                                       %&%
0058 rqre_datatype( nonlin, {@isboolean} );                                     %&%
0059 
0060 
0061 i = length(Q.ABS_SPECIES) + 1;
0062 
0063 
0064 for j = 1 : length(tags)
0065   Q.ABS_SPECIES{i}{j} = tags{j};
0066 end
0067 
0068 
0069 if nonlin
0070   Q.ABS_NLS = { Q.ABS_NLS, arts_tgs_cnvrt(Q.ABS_SPECIES) };
0071 end
0072 
0073 
0074 if isstruct( Q.J )
0075   Q.J.ABS_SPECIES(i).DO = do_j;  
0076 end
0077 
0078 
0079 if do_j
0080   Q.J.ABS_SPECIES(i).UNIT   = unit;
0081   Q.J.ABS_SPECIES(i).METHOD = method;
0082   Q.J.ABS_SPECIES(i).DX     = dx;
0083   Q.J.ABS_SPECIES(i).GRID1  = grids{1};
0084 
0085   if Q.ATMOSPHERE_DIM >= 2
0086     Q.J.ABS_SPECIES(i).GRID2 = grids{2};
0087 
0088     if Q.ATMOSPHERE_DIM >= 3
0089       Q.J.ABS_SPECIES(i).GRID3 = grids{3};
0090     end
0091   end
0092 
0093   SX.ABS_SPECIES{i} = D;
0094 end

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