Home > atmlab > demos > qarts_ppath_demo.m

qarts_ppath_demo

PURPOSE ^

QARTS_PPATH_DEMO Example on how to calculate a propagation path

SYNOPSIS ^

function ppath = qarts_ppath_demo(zplat,za,varargin)

DESCRIPTION ^

 QARTS_PPATH_DEMO   Example on how to calculate a propagation path

    Calculates the (main) propagation path, using ARTS.

    The atmosphere is set to be 1D, with the surface at 0 m. The Fascod
    tropical scenario is used.

 FORMAT   ppath = qarts_ppath_demo( zplat, za [, refr, lmax, lraytrace] )
        
 OUT   Q          Ppath data structure.
 IN    zplat      Platform altitude.
       za         Zenith angle.
 OPT   refr       Flag to include refraction. Default is false.
       lmax       Value for ppath_lmax. Default is -1.
       lraytrace  Value for ppath_lraytrace. Default is 1e3.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

qarts_ppath_demo.m

SOURCE CODE ^

0001 % QARTS_PPATH_DEMO   Example on how to calculate a propagation path
0002 %
0003 %    Calculates the (main) propagation path, using ARTS.
0004 %
0005 %    The atmosphere is set to be 1D, with the surface at 0 m. The Fascod
0006 %    tropical scenario is used.
0007 %
0008 % FORMAT   ppath = qarts_ppath_demo( zplat, za [, refr, lmax, lraytrace] )
0009 %
0010 % OUT   Q          Ppath data structure.
0011 % IN    zplat      Platform altitude.
0012 %       za         Zenith angle.
0013 % OPT   refr       Flag to include refraction. Default is false.
0014 %       lmax       Value for ppath_lmax. Default is -1.
0015 %       lraytrace  Value for ppath_lraytrace. Default is 1e3.
0016 
0017 % 2013-04-16   Created, Patrick Eriksson.
0018 
0019 function ppath = qarts_ppath_demo(zplat,za,varargin)
0020 %
0021 [refr,lmax,lraytrace] = optargs( varargin, { false, -1, 1e3 } );
0022 
0023   
0024 %= Atmlab settings
0025 %
0026 arts_xmldata_path = atmlab( 'ARTS_XMLDATA_PATH' );
0027 %
0028 if isnan( arts_xmldata_path )
0029   error('You need to ARTS_XMLDATA_PATH to run this example.');
0030 end
0031 %
0032 fascod = fullfile( arts_xmldata_path, 'planets', 'Earth', 'Fascod' );
0033 
0034   
0035 %= Init Q structures
0036 %
0037 Q  = qarts;
0038 %
0039 Q.INCLUDES              = { fullfile( 'ARTS_INCLUDES', 'general.arts' ), ...
0040                             fullfile( 'ARTS_INCLUDES', 'agendas.arts' ), ...
0041                             fullfile( 'ARTS_INCLUDES', 'planet_earth.arts' ) };
0042 %
0043 Q.CLOUDBOX_DO           = false;
0044 %
0045 Q.STOKES_DIM            = 1;
0046 Q.F_GRID                = 100e9;  % Here a dummy value
0047 
0048 %= Define agendas
0049 %
0050 Q.PPATH_AGENDA               = { 'ppath_agenda__FollowSensorLosPath' };
0051 if refr
0052   Q.PPATH_STEP_AGENDA        = { 'ppath_step_agenda__RefractedPath'   };
0053   Q.REFR_INDEX_AIR_AGENDA    = { 'refr_index_air_agenda__GasThayer'      };
0054 else
0055   Q.PPATH_STEP_AGENDA        = { 'ppath_step_agenda__GeometricPath'  };
0056 end
0057 
0058 
0059 %= Only H2O needed here (to get correct refractive index)
0060 %
0061 Q.ABS_SPECIES(1).TAG{1} = 'H2O';
0062 
0063 
0064 %= Set-up atmosphere and surface
0065 %
0066 Q.ATMOSPHERE_DIM         = 1;
0067 %
0068 Q.P_GRID                 = z2p_simple( [-100:250:60e3]' );
0069 %
0070 Q.RAW_ATMOSPHERE        = fullfile( arts_xmldata_path, 'planets', 'Earth', ...
0071                                            'Fascod', 'tropical', 'tropical' );
0072 Q.RAW_ATM_EXPAND_1D     = false;
0073 %
0074 Q.REFELLIPSOID          = ellipsoidmodels( 'SphericalEarth' );
0075 Q.Z_SURFACE             = 0;
0076 
0077 
0078 %= Set position and line-of-sight
0079 %
0080 Q.SENSOR_POS        = zplat;
0081 Q.SENSOR_LOS        = za;    
0082 
0083 %= ppath step lengths
0084 %
0085 Q.PPATH_LMAX        = lmax;
0086 Q.PPATH_LRAYTRACE   = lraytrace;
0087 
0088 
0089 %= Include call of ppathCalc
0090 %
0091 workfolder = create_tmpfolder;
0092 %
0093 Q.WSMS_AT_END           = { 
0094     'VectorExtractFromMatrix(rte_pos,sensor_pos,0,"row")', ...
0095     'VectorExtractFromMatrix(rte_los,sensor_los,0,"row")', ...
0096     'VectorSet(rte_pos2,[])', ...
0097     'ppathCalc', ...
0098     sprintf('ppathWriteXMLPartial("ascii",ppath,"%s/ppath.xml")',workfolder) };
0099 
0100 
0101 %= Run ARTS and load result
0102 %
0103 % There is no dedicated high-level function for this ...
0104 %
0105 S = qarts2cfile( Q, { 'Generl', 'AtmSrf', 'AbsrptSave', 'CldBox', ...
0106                       'RteSet', 'CloseF' }, workfolder );
0107 cfile = fullfile( workfolder, 'cfile.arts' );
0108 strs2file( cfile, S );
0109 notok = arts( cfile, true );
0110 %
0111 if notok
0112   fprintf('\n!!! Error while running ARTS !!!\n');
0113   keyboard
0114 else
0115   ppath = xmlLoad( fullfile( workfolder, 'ppath.xml' ) );
0116 end
0117 %
0118 delete_tmpfolder( workfolder );
0119 
0120 
0121

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