Home > atmlab > arts > arts_sensor.m

arts_sensor

PURPOSE ^

ARTS_SENSOR Calculates sensor response matrix using ARTS

SYNOPSIS ^

function Q = arts_sensor( Q, varargin )

DESCRIPTION ^

 ARTS_SENSOR   Calculates sensor response matrix using ARTS

    Takes a qarts structure and calculates corresponding sensor reponse 
    transfer matrix. 

    The result can be returned in two different ways. 

    1: Data are loaded into Q if no workfolder is specified or *do_load* is
    set.

    2. The fields of Q contain the names of created xml files if a 
    workfolder is given (and do_load=false). This option is more efficient
    if the data shall be used for later ARTS runs (and not inside Matlab).

 FORMAT   Q = arts_sensor( Q [, workfolder] )
        
 OUT   Q            Q with the following fields set:
                        SENSOR_RESPONSE   
                        SENSOR_RESPONSE_F
                        SENSOR_RESPONSE_ZA
                        SENSOR_RESPONSE_AA
                        SENSOR_RESPONSE_POL
                        SENSOR_RESPONSE_F_GRID
                        SENSOR_RESPONSE_ZA_GRID
                        SENSOR_RESPONSE_AA_GRID
                        SENSOR_RESPONSE_POL_GRID
                        ANTENNA_DIM        
                        MBLOCK_ZA_GRID     
                        MBLOCK_AA_GRIDS
                    See further above.
 IN    Q            Qarts structure.
 OPT   workfolder   If not defined or empty, a temporary folder is created.
                    Otherwise this is interpreted as the path to a folder 
                    where calculation output can be stored. These files
                    will be left in the folder. The files are not read if
                    corresponding output argument not is considered.
                    Default is [].
       do_load      Flag to trigger loading even if a workfolder has been
                    given.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

arts_sensor.m

SOURCE CODE ^

0001 % ARTS_SENSOR   Calculates sensor response matrix using ARTS
0002 %
0003 %    Takes a qarts structure and calculates corresponding sensor reponse
0004 %    transfer matrix.
0005 %
0006 %    The result can be returned in two different ways.
0007 %
0008 %    1: Data are loaded into Q if no workfolder is specified or *do_load* is
0009 %    set.
0010 %
0011 %    2. The fields of Q contain the names of created xml files if a
0012 %    workfolder is given (and do_load=false). This option is more efficient
0013 %    if the data shall be used for later ARTS runs (and not inside Matlab).
0014 %
0015 % FORMAT   Q = arts_sensor( Q [, workfolder] )
0016 %
0017 % OUT   Q            Q with the following fields set:
0018 %                        SENSOR_RESPONSE
0019 %                        SENSOR_RESPONSE_F
0020 %                        SENSOR_RESPONSE_ZA
0021 %                        SENSOR_RESPONSE_AA
0022 %                        SENSOR_RESPONSE_POL
0023 %                        SENSOR_RESPONSE_F_GRID
0024 %                        SENSOR_RESPONSE_ZA_GRID
0025 %                        SENSOR_RESPONSE_AA_GRID
0026 %                        SENSOR_RESPONSE_POL_GRID
0027 %                        ANTENNA_DIM
0028 %                        MBLOCK_ZA_GRID
0029 %                        MBLOCK_AA_GRIDS
0030 %                    See further above.
0031 % IN    Q            Qarts structure.
0032 % OPT   workfolder   If not defined or empty, a temporary folder is created.
0033 %                    Otherwise this is interpreted as the path to a folder
0034 %                    where calculation output can be stored. These files
0035 %                    will be left in the folder. The files are not read if
0036 %                    corresponding output argument not is considered.
0037 %                    Default is [].
0038 %       do_load      Flag to trigger loading even if a workfolder has been
0039 %                    given.
0040 
0041 % 2007-08-22   Created by Patrick Eriksson.
0042 
0043 
0044 function Q = arts_sensor( Q, varargin )
0045 %
0046 [workfolder,do_load] = optargs( varargin, { [], false } );
0047                                                                  %&%
0048 %= Check input                                                   %&%
0049 %                                                                %&%
0050 rqre_nargin(1,nargin);                                           %&%
0051 %                                                                %&%
0052 rqre_datatype( Q, @isstruct );                                   %&%
0053 rqre_datatype( workfolder, {@isempty,@ischar} );                 %&%
0054 rqre_datatype( do_load, @isboolean );                            %&%
0055 
0056 
0057 if isempty( workfolder )
0058   workfolder = create_tmpfolder;
0059   cu = onCleanup( @()delete_tmpfolder( workfolder ) );
0060   folder_created = 1;
0061 else
0062   folder_created = 0;  
0063 end
0064 
0065 
0066 %= Run ARTS
0067 %
0068 parts = qarts2cfile( 'GetSensor' );
0069 S     = qarts2cfile( Q, parts, workfolder );
0070 cfile = fullfile( workfolder, 'cfile.arts' );
0071 strs2file( cfile, S );
0072 arts( cfile );
0073 
0074 
0075 if nargout
0076   
0077 if folder_created  |  do_load
0078   Q.SENSOR_RESPONSE = ...
0079                  xmlLoad( fullfile( workfolder, 'sensor_response.xml' ) );
0080   Q.SENSOR_RESPONSE_F = ...
0081                  xmlLoad( fullfile( workfolder, 'sensor_response_f.xml' ) );
0082   Q.SENSOR_RESPONSE_ZA = ...
0083                  xmlLoad( fullfile( workfolder, 'sensor_response_za.xml' ) );
0084   Q.SENSOR_RESPONSE_AA = ...
0085                  xmlLoad( fullfile( workfolder, 'sensor_response_aa.xml' ) );
0086   Q.SENSOR_RESPONSE_POL = ...
0087                  xmlLoad( fullfile( workfolder, 'sensor_response_pol.xml' ) );
0088   Q.SENSOR_RESPONSE_F_GRID = ...
0089               xmlLoad( fullfile( workfolder, 'sensor_response_f_grid.xml' ) );
0090   Q.SENSOR_RESPONSE_ZA_GRID = ...
0091               xmlLoad( fullfile( workfolder, 'sensor_response_za_grid.xml' ) );
0092   Q.SENSOR_RESPONSE_AA_GRID = ...
0093               xmlLoad( fullfile( workfolder, 'sensor_response_aa_grid.xml' ) );
0094   Q.SENSOR_RESPONSE_POL_GRID = ...
0095               xmlLoad( fullfile( workfolder, 'sensor_response_pol_grid.xml' ) );
0096   Q.ANTENNA_DIM = ...
0097                  xmlLoad( fullfile( workfolder, 'antenna_dim.xml' ) );
0098   Q.MBLOCK_ZA_GRID = ...
0099                  xmlLoad( fullfile( workfolder, 'mblock_za_grid.xml' ) );
0100   Q.MBLOCK_AA_GRID = ...
0101                  xmlLoad( fullfile( workfolder, 'mblock_aa_grid.xml' ) );
0102 else
0103   Q.SENSOR_RESPONSE     = fullfile( workfolder, 'sensor_response.xml' );
0104   Q.SENSOR_RESPONSE_F   = fullfile( workfolder, 'sensor_response_f.xml' );
0105   Q.SENSOR_RESPONSE_ZA  = fullfile( workfolder, 'sensor_response_za.xml' );
0106   Q.SENSOR_RESPONSE_AA  = fullfile( workfolder, 'sensor_response_aa.xml' );
0107   Q.SENSOR_RESPONSE_POL = fullfile( workfolder, 'sensor_response_pol.xml' );
0108   Q.SENSOR_RESPONSE_F_GRID = ...
0109                          fullfile( workfolder, 'sensor_response_f_grid.xml' );
0110   Q.SENSOR_RESPONSE_ZA_GRID = ...
0111                          fullfile( workfolder, 'sensor_response_za_grid.xml' );
0112   Q.SENSOR_RESPONSE_AA_GRID = ...
0113                          fullfile( workfolder, 'sensor_response_aa_grid.xml' );
0114   Q.SENSOR_RESPONSE_POL_GRID = ... 
0115                          fullfile( workfolder, 'sensor_response_pol_grid.xml' );
0116   Q.ANTENNA_DIM         = fullfile( workfolder, 'antenna_dim.xml' );
0117   Q.MBLOCK_ZA_GRID      = fullfile( workfolder, 'mblock_za_grid.xml' );
0118   Q.MBLOCK_AA_GRID      = fullfile( workfolder, 'mblock_aa_grid.xml' );
0119 end
0120 
0121 end
0122

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