Home > atmlab > atmlab > atmlab.m

atmlab

PURPOSE ^

ATMLAB Handling of Atmlab settings.

SYNOPSIS ^

function value = atmlab( varargin )

DESCRIPTION ^

 ATMLAB   Handling of Atmlab settings.

   This function is based on *prstnt_struct* and for general help see 
   the on-line help for that function. 

   Existing fields, and possible settings, are listed below. 

   For adding personal settings at startup, see the file CONFIGURE. To 
   add or change settings after startup, follow the example below. 

   To check all present settings
      atmlab;

   A specific setting is obtained as
      value = atmlab( 'FMODEL_NAME' );

   To set a field to a specic value
      atmlab( 'FMODEL_NAME', 'arts' );

   To set all fields to default
      atmlab( 'defaults' );

 FORMAT   value = atmlab( [varargin] )
        
 OUT   value      Setting, if a field is selected. See further 
                  *prstnt_struct*.
 OPT   varargin   Field, field and setting or any option supported by
                  *prstnt_struct*.

----------------------------------------------------------------------------
 ARTS_INCLUDES

 Path to main folder for ARTS include files. 
 For example '/home/patrick/ARTS/arts2/include'.
----------------------------------------------------------------------------
 ARTS_PATH

 Path to executable for ARTS. For example '/home/patrick/ARTS/arts2/src/arts'.
----------------------------------------------------------------------------
 ARTS_XMLDATA_PATH

 Path to main folder of arts-xml-data. 
 The arts-xml-data is a compilation of useful data for ARTS calculations.
 Contact the ARTS team if you want access to the data. The data is used
 as input for ARTS example/utility functions. 
----------------------------------------------------------------------------
 ATMLAB_DATA_PATH

 Path to main directory of atmlab-data
 atmlab-data is a compilation of useful data for various atmlab tasks.
 It is available in the atmlab-data/trunk directory of the rt svn repo.
--------------------------------------------------------------------------
 ATMLAB_PATH

 Path to main directory of atmlab.
 Can be used by the user to override automatic determination of this file,
 or is otherwise set by initialisation functions for other functions to
 use.
----------------------------------------------------------------------------
 DEBUG

 Flag to set to simplify debugging. No overall effect, but this flag is
 recognised by some functions. For example, if this flag is set the temporary
 work folders are not removed, to make it possible to check the content
 in these folders.
----------------------------------------------------------------------------
 ERR

 Stream to log error messages to. Used by some subsystems.
----------------------------------------------------------------------------
 FMODEL_VERBOSITY

 Verbosity of forward model, if such a feature is supported. If field is
 is empty, this is interpreted as no verbosity. The forward models work as:
   ARTS (both versions):
     A number between 0 and 3, where 3 means highest level of verbosity.
----------------------------------------------------------------------------
 LEGACY_MODE

 Include deprecated functions and settings. Used by some subsystems.
----------------------------------------------------------------------------
 OUT

 Stream to log ordinary messages to. Used by some subsystems.
----------------------------------------------------------------------------
 PYTHON

 Path to Python interpreter to use in relevant situations.
----------------------------------------------------------------------------
 RAND_STATE

 Initialisation of random states (for rand and randn). Either NaN or an
 integer. If set to NaN, a semi-random state is generated. Otherwise the
 specified value is used as state for both rand and randn.
 A new state is initialised directly by this function.
----------------------------------------------------------------------------
 SITE

 Location, system, e.g. Kiruna, Chalmers. If there is a directory
 site-specific/SITE, this will be used to initialise default values for
 the settings for some subsystems (for example, datasets will 'know' where to
 find data).
----------------------------------------------------------------------------
 SCREEN_WIDTH
 
 The width, in number of characters, of the Matlab window.
 Used by the function *out* to make a frame around screen output.
----------------------------------------------------------------------------
 STRICT_ASSERT
 
 Some parts of atmlab performs quite strict checks of input arguments and
 data. Such asserts and checks can in some cases take a significant fraction
 of the calculation time in a function (or even dominate the time) and, to
 allow faster calculations, some functions use this flag to possibly
 deactivate the checks. Default is true and the checks are performed. If you
 have a stable set-up, you can set this field to false and potentially improve
 the calculation speed. That is, if you are sure that the assertions
 are not needed (only applies to assertions in "if amtlab('STRICT_ASSERT')"
 environments), then set atmlab('STRICT_ASSERT')=false;
----------------------------------------------------------------------------
 VERBOSITY
 
 The verbosity of Atmlab functions.  
 Functions writing to the screen set a report level for each output. If the
 the set report level is higher than VERBOSITY, the output is ignored.
 Output obeying this setting is most easily produced with the function *out*.
 Functions can also use VERBOSITY to decide if figures shall be produced
 (which is most easily checked by using *out*).
----------------------------------------------------------------------------
 WORK_AREA
 
 A folder to be used for calculations outside Matlab. For each calculation
 session, a temporary folder is created in the given folder. Atmlab tries to
 keep the given folder clean by removing the temporary folders when ready, but
 if there is a crash the temporary folder can occasionaly be left. The
 temporary folders are not re-used and it can be a good idea to now and then
 remove old temporary folders. 
 The full path shall be given. A normal choice for work area on Unix type
 platforms is '/tmp'. The work area is primarily used for forward model
 calculations, but there could be other applications.
 ----------------------------------------------------------------------------

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

DOWNLOAD ^

atmlab.m

SOURCE CODE ^

0001 % ATMLAB   Handling of Atmlab settings.
0002 %
0003 %   This function is based on *prstnt_struct* and for general help see
0004 %   the on-line help for that function.
0005 %
0006 %   Existing fields, and possible settings, are listed below.
0007 %
0008 %   For adding personal settings at startup, see the file CONFIGURE. To
0009 %   add or change settings after startup, follow the example below.
0010 %
0011 %   To check all present settings
0012 %      atmlab;
0013 %
0014 %   A specific setting is obtained as
0015 %      value = atmlab( 'FMODEL_NAME' );
0016 %
0017 %   To set a field to a specic value
0018 %      atmlab( 'FMODEL_NAME', 'arts' );
0019 %
0020 %   To set all fields to default
0021 %      atmlab( 'defaults' );
0022 %
0023 % FORMAT   value = atmlab( [varargin] )
0024 %
0025 % OUT   value      Setting, if a field is selected. See further
0026 %                  *prstnt_struct*.
0027 % OPT   varargin   Field, field and setting or any option supported by
0028 %                  *prstnt_struct*.
0029 %
0030 %----------------------------------------------------------------------------
0031 % ARTS_INCLUDES
0032 %
0033 % Path to main folder for ARTS include files.
0034 % For example '/home/patrick/ARTS/arts2/include'.
0035 %----------------------------------------------------------------------------
0036 % ARTS_PATH
0037 %
0038 % Path to executable for ARTS. For example '/home/patrick/ARTS/arts2/src/arts'.
0039 %----------------------------------------------------------------------------
0040 % ARTS_XMLDATA_PATH
0041 %
0042 % Path to main folder of arts-xml-data.
0043 % The arts-xml-data is a compilation of useful data for ARTS calculations.
0044 % Contact the ARTS team if you want access to the data. The data is used
0045 % as input for ARTS example/utility functions.
0046 %----------------------------------------------------------------------------
0047 % ATMLAB_DATA_PATH
0048 %
0049 % Path to main directory of atmlab-data
0050 % atmlab-data is a compilation of useful data for various atmlab tasks.
0051 % It is available in the atmlab-data/trunk directory of the rt svn repo.
0052 %--------------------------------------------------------------------------
0053 % ATMLAB_PATH
0054 %
0055 % Path to main directory of atmlab.
0056 % Can be used by the user to override automatic determination of this file,
0057 % or is otherwise set by initialisation functions for other functions to
0058 % use.
0059 %----------------------------------------------------------------------------
0060 % DEBUG
0061 %
0062 % Flag to set to simplify debugging. No overall effect, but this flag is
0063 % recognised by some functions. For example, if this flag is set the temporary
0064 % work folders are not removed, to make it possible to check the content
0065 % in these folders.
0066 %----------------------------------------------------------------------------
0067 % ERR
0068 %
0069 % Stream to log error messages to. Used by some subsystems.
0070 %----------------------------------------------------------------------------
0071 % FMODEL_VERBOSITY
0072 %
0073 % Verbosity of forward model, if such a feature is supported. If field is
0074 % is empty, this is interpreted as no verbosity. The forward models work as:
0075 %   ARTS (both versions):
0076 %     A number between 0 and 3, where 3 means highest level of verbosity.
0077 %----------------------------------------------------------------------------
0078 % LEGACY_MODE
0079 %
0080 % Include deprecated functions and settings. Used by some subsystems.
0081 %----------------------------------------------------------------------------
0082 % OUT
0083 %
0084 % Stream to log ordinary messages to. Used by some subsystems.
0085 %----------------------------------------------------------------------------
0086 % PYTHON
0087 %
0088 % Path to Python interpreter to use in relevant situations.
0089 %----------------------------------------------------------------------------
0090 % RAND_STATE
0091 %
0092 % Initialisation of random states (for rand and randn). Either NaN or an
0093 % integer. If set to NaN, a semi-random state is generated. Otherwise the
0094 % specified value is used as state for both rand and randn.
0095 % A new state is initialised directly by this function.
0096 %----------------------------------------------------------------------------
0097 % SITE
0098 %
0099 % Location, system, e.g. Kiruna, Chalmers. If there is a directory
0100 % site-specific/SITE, this will be used to initialise default values for
0101 % the settings for some subsystems (for example, datasets will 'know' where to
0102 % find data).
0103 %----------------------------------------------------------------------------
0104 % SCREEN_WIDTH
0105 %
0106 % The width, in number of characters, of the Matlab window.
0107 % Used by the function *out* to make a frame around screen output.
0108 %----------------------------------------------------------------------------
0109 % STRICT_ASSERT
0110 %
0111 % Some parts of atmlab performs quite strict checks of input arguments and
0112 % data. Such asserts and checks can in some cases take a significant fraction
0113 % of the calculation time in a function (or even dominate the time) and, to
0114 % allow faster calculations, some functions use this flag to possibly
0115 % deactivate the checks. Default is true and the checks are performed. If you
0116 % have a stable set-up, you can set this field to false and potentially improve
0117 % the calculation speed. That is, if you are sure that the assertions
0118 % are not needed (only applies to assertions in "if amtlab('STRICT_ASSERT')"
0119 % environments), then set atmlab('STRICT_ASSERT')=false;
0120 %----------------------------------------------------------------------------
0121 % VERBOSITY
0122 %
0123 % The verbosity of Atmlab functions.
0124 % Functions writing to the screen set a report level for each output. If the
0125 % the set report level is higher than VERBOSITY, the output is ignored.
0126 % Output obeying this setting is most easily produced with the function *out*.
0127 % Functions can also use VERBOSITY to decide if figures shall be produced
0128 % (which is most easily checked by using *out*).
0129 %----------------------------------------------------------------------------
0130 % WORK_AREA
0131 %
0132 % A folder to be used for calculations outside Matlab. For each calculation
0133 % session, a temporary folder is created in the given folder. Atmlab tries to
0134 % keep the given folder clean by removing the temporary folders when ready, but
0135 % if there is a crash the temporary folder can occasionaly be left. The
0136 % temporary folders are not re-used and it can be a good idea to now and then
0137 % remove old temporary folders.
0138 % The full path shall be given. A normal choice for work area on Unix type
0139 % platforms is '/tmp'. The work area is primarily used for forward model
0140 % calculations, but there could be other applications.
0141 % ----------------------------------------------------------------------------
0142 
0143 % 2003-07-06   Created by Patrick Eriksson.
0144 
0145 
0146 function value = atmlab( varargin )
0147             
0148 persistent A
0149 
0150 [A,value] = prstnt_struct( A, @atmlab_defs, varargin );
0151 
0152 
0153 %- Some settings require direct action
0154   
0155 if length(varargin) == 2
0156 
0157   switch varargin{1}
0158     
0159    case 'RAND_STATE'
0160     %
0161     rand_state = varargin{2}
0162     %
0163     if isnan( rand_state )
0164       %- Create random state. Add window number to get different states for
0165       %  different matlab runs (works only for linux).
0166       %
0167       nr = getenv('WINDOWID');
0168       if isempty(nr)
0169         nr = 0;
0170       else
0171         nr = str2double( nr );
0172       end
0173       %
0174       rand( 'state', sum(100*clock) + nr );
0175       randn( 'state', sum(100*clock) + nr );
0176      
0177     else
0178       rand( 'state', rand_state );
0179       randn( 'state', rand_state );
0180     end
0181 
0182    case 'SITE'
0183     %
0184     addsite;
0185     
0186   end
0187 end
0188 %
0189 return
0190 
0191 end
0192   
0193 %---------------------------------------------------------------------------
0194 function A = atmlab_defs
0195 
0196 A.ARTS_INCLUDES     = NaN;
0197 A.ARTS_PATH         = NaN;
0198 A.ARTS_XMLDATA_PATH = NaN;
0199 A.ATMLAB_PATH       = NaN;
0200 A.ATMLAB_DATA_PATH  = NaN;
0201 A.DEBUG             = false;
0202 A.ERR               = 2;
0203 A.FMODEL_VERBOSITY  = 0;
0204 A.LEGACY_MODE       = false;
0205 A.OUT               = 1;
0206 [u,X] = system('type -p python');
0207 A.PYTHON            = strtrim(X);
0208 A.RAND_STATE        = NaN;
0209 A.SCREEN_WIDTH      = 70;
0210 A.SITE              = NaN;
0211 A.STRICT_ASSERT     = true;
0212 A.VERBOSITY         = 1;
0213 A.WORK_AREA         = tempdir();
0214 A.STRICT_ASSERT     = true;
0215 
0216 end

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