Home > atmlab > arts > arts.m

arts

PURPOSE ^

ARTS Call ARTS

SYNOPSIS ^

function [status,result] = arts(cfile,varargin)

DESCRIPTION ^

 ARTS   Call ARTS 

    Calls ARTS where path to executable and verbosity are taken from personal
    settings. That is, the settings ARTS_PATH and 
    FMODEL_VERBOSITY are used (see futher*atmlab*).

    Note that Matlab allows a call as
        arts -h;
    which can be usefull when working in Matlab and you want to use the
    on-line documentation of ARTS. If your call needs an argument, put
    all inside a string, as:
       arts '-w all';

 FORMAT   [status,result] = arts( cfile [,errortol,noecho] )
        
 OUT   status     Status returned by ARTS. Is 0 if all OK.
       result     String containing messages to standard output.
 IN    cfile      Name on control file, or OK command line option such as
                  '-h'.
 OPT   errortol   Flag to tolerate error. If set to 0, an ARTS error gives
                  rise also to a Matlab error. Default is 0.
       noecho     Flag to suppress screen output. Default is false.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

arts.m

SOURCE CODE ^

0001 % ARTS   Call ARTS
0002 %
0003 %    Calls ARTS where path to executable and verbosity are taken from personal
0004 %    settings. That is, the settings ARTS_PATH and
0005 %    FMODEL_VERBOSITY are used (see futher*atmlab*).
0006 %
0007 %    Note that Matlab allows a call as
0008 %        arts -h;
0009 %    which can be usefull when working in Matlab and you want to use the
0010 %    on-line documentation of ARTS. If your call needs an argument, put
0011 %    all inside a string, as:
0012 %       arts '-w all';
0013 %
0014 % FORMAT   [status,result] = arts( cfile [,errortol,noecho] )
0015 %
0016 % OUT   status     Status returned by ARTS. Is 0 if all OK.
0017 %       result     String containing messages to standard output.
0018 % IN    cfile      Name on control file, or OK command line option such as
0019 %                  '-h'.
0020 % OPT   errortol   Flag to tolerate error. If set to 0, an ARTS error gives
0021 %                  rise also to a Matlab error. Default is 0.
0022 %       noecho     Flag to suppress screen output. Default is false.
0023 
0024 % 2004-09-07   Created by Patrick Eriksson.
0025 
0026 function [status,result] = arts(cfile,varargin)
0027 %
0028 [errortol,noecho] = optargs( varargin, { 0, false } );
0029                                                                 
0030 
0031 atmlab( 'require', {'ARTS_PATH','FMODEL_VERBOSITY'} );           %&%
0032 
0033 exec   = atmlab( 'ARTS_PATH' );
0034 rlevel = atmlab( 'FMODEL_VERBOSITY' );
0035                                                                  %&%
0036 if isempty( exec )                                               %&%
0037   error('Path to ARTS executable must be a string.');            %&%
0038 end                                                              %&%
0039 if isempty( rlevel )                                             %&%
0040   rlevel = 0;                                                    %&%
0041 end                                                              %&%
0042 
0043 outdir = fileparts( cfile );
0044 
0045 if noecho
0046   if isempty( outdir )
0047     [status,result] = system( ...
0048                        sprintf('%s -r%d0 %s', exec, rlevel, cfile ) );
0049   else
0050     [status,result] = system( ...
0051          sprintf('%s -r%d0 -o %s %s', exec, rlevel, outdir, cfile ) );
0052   end  
0053 else
0054   if isempty( outdir )
0055     [status,result] = system( ...
0056                        sprintf('%s -r%d0 %s', exec, rlevel, cfile ), '-echo' );
0057   else
0058     [status,result] = system( ...
0059          sprintf('%s -r%d0 -o %s %s', exec, rlevel, outdir, cfile ), '-echo' );
0060   end
0061 end
0062 
0063 
0064 if status  &  ~errortol
0065   %disp( result )
0066   fprintf('\n');
0067   error('An error occured while executing ARTS. See above.')
0068 end
0069

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