Home > atmlab > arts > arts_tgs2species.m

arts_tgs2species

PURPOSE ^

ARTS_TGS2SPECIES Extracts species name from tag definitions

SYNOPSIS ^

function species = arts_tgs2species( a, iso )

DESCRIPTION ^

 ARTS_TGS2SPECIES  Extracts species name from tag definitions

    Returns species or isotopologe name. For example,
    'H20-161-501e9-505e9' is converted to 'H2O' or 'H2O-161', depending on
    status of *iso*. 
 
    Note that the internal arts format is not handled here (as in 
    *arts_tgs_cnvrt*). 

    Example:
       arts_tgs2species( Q.ABS_SPECIES(i).TAG{1} )

 FORMAT   species = arts_tgs2species( a, iso )
        
 OUT   species   Species name. 
 IN    a         Tag. A string. 
 OPT   iso       Include isotopomer numbers. Default is false.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

arts_tgs2species.m

SOURCE CODE ^

0001 % ARTS_TGS2SPECIES  Extracts species name from tag definitions
0002 %
0003 %    Returns species or isotopologe name. For example,
0004 %    'H20-161-501e9-505e9' is converted to 'H2O' or 'H2O-161', depending on
0005 %    status of *iso*.
0006 %
0007 %    Note that the internal arts format is not handled here (as in
0008 %    *arts_tgs_cnvrt*).
0009 %
0010 %    Example:
0011 %       arts_tgs2species( Q.ABS_SPECIES(i).TAG{1} )
0012 %
0013 % FORMAT   species = arts_tgs2species( a, iso )
0014 %
0015 % OUT   species   Species name.
0016 % IN    a         Tag. A string.
0017 % OPT   iso       Include isotopomer numbers. Default is false.
0018 
0019 % 2007-05-14   Created by Patrick Eriksson.
0020 
0021 
0022 function species = arts_tgs2species( a, iso )
0023 if nargin < 2
0024   iso = false;
0025 end
0026                                                                             %&%
0027 rqre_nargin( 1, nargin );                                                   %&%
0028 rqre_datatype( a, @ischar );                                                %&%
0029 rqre_datatype( iso, @isboolean );                                           %&%
0030 
0031 
0032 ind = find( a == '-' );
0033 
0034 % Expand to cover all possible cases
0035 ind = [ ind repmat(length(a)+1,1,2) ];
0036   
0037 if ~iso 
0038   species = a(1:ind(1)-1);
0039 else
0040   species = a(1:ind(2)-1);
0041 end   
0042

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