Home > atmlab > forwardmodel > pathpoint2sensorposlos.m

pathpoint2sensorposlos

PURPOSE ^

PATHPOINT2SENSORPOSLOS Match sensor pos/los with a geometrical LOS point

SYNOPSIS ^

function [spos,slos] = pathpoint2sensorposlos(dim,ppos,plos,r_sensor)

DESCRIPTION ^

 PATHPOINT2SENSORPOSLOS   Match sensor pos/los with a geometrical LOS point

   Calculates sensor position and line-of-sight (LOS) based on a point
   along a pure geometrical (no refraction) propagation path, and the
   sensor altitude (given as the radius, from geoid center). Both a position
   and a LOS for the propagation path point must be given.

   Positions and LOS are given following the ARTS coordinate systems.
   Note that LOS is defined as the viewing direction (not photon direction).
  
   Positions have dimensions (r), (r,lat) and (r,lat,lon) for 1D/2D/3D.
   
   A LOS is given as (za) for 1D and 2D, and (za,aa) for 3D, where za is
   zenith angle, and aa is azimuth angle. A negative za for 2D means a LOS
   towards lower latitudes.

 FORMAT   [spos,slos] = pathpoint2sensorposlos(dim,ppos,plos,r_sensor)
        
 OUT   spos       Sensor position.
       slos       Sensor line-of-sight.
 IN    dim        Atmospheric dimensionality
       ppos       Point on propagation path.
       plos       Line-of-sight at *ppos*.
       r_sensor   Radius for sensor position.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

pathpoint2sensorposlos.m

SOURCE CODE ^

0001 % PATHPOINT2SENSORPOSLOS   Match sensor pos/los with a geometrical LOS point
0002 %
0003 %   Calculates sensor position and line-of-sight (LOS) based on a point
0004 %   along a pure geometrical (no refraction) propagation path, and the
0005 %   sensor altitude (given as the radius, from geoid center). Both a position
0006 %   and a LOS for the propagation path point must be given.
0007 %
0008 %   Positions and LOS are given following the ARTS coordinate systems.
0009 %   Note that LOS is defined as the viewing direction (not photon direction).
0010 %
0011 %   Positions have dimensions (r), (r,lat) and (r,lat,lon) for 1D/2D/3D.
0012 %
0013 %   A LOS is given as (za) for 1D and 2D, and (za,aa) for 3D, where za is
0014 %   zenith angle, and aa is azimuth angle. A negative za for 2D means a LOS
0015 %   towards lower latitudes.
0016 %
0017 % FORMAT   [spos,slos] = pathpoint2sensorposlos(dim,ppos,plos,r_sensor)
0018 %
0019 % OUT   spos       Sensor position.
0020 %       slos       Sensor line-of-sight.
0021 % IN    dim        Atmospheric dimensionality
0022 %       ppos       Point on propagation path.
0023 %       plos       Line-of-sight at *ppos*.
0024 %       r_sensor   Radius for sensor position.
0025 
0026 % 2007-05-16   Created by Patrick Eriksson.
0027 
0028 
0029 function [spos,slos] = pathpoint2sensorposlos(dim,ppos,plos,r_sensor)
0030                                                                          %&%
0031                                                                          %&%
0032 %- Check input                                                           %&%
0033 %                                                                        %&%
0034 rqre_alltypes( dim, {@istensor0,@iswhole} );                             %&%
0035 rqre_in_range( dim, 1, 3 );                                              %&%
0036 rqre_datatype( ppos, @isvector );                                        %&%
0037 rqre_datatype( plos, @isvector );                                        %&%
0038 rqre_datatype( r_sensor, @istensor0 );                                   %&%
0039 rqre_in_range( r_sensor, 0 );                                            %&%
0040 %                                                                        %&%
0041 if length(ppos) ~= dim                                                   %&%
0042   error('Length of *ppos* must be equal to *dim*.' );                    %&%
0043 end                                                                      %&%
0044 %                                                                        %&%
0045 if  ~( (dim<=2 & length(plos)==1)  | (dim==3 & length(plos)==2) )        %&%
0046   error('Length of *plos* does not match *dim*.' );                      %&%
0047 end                                                                      %&%
0048 
0049 
0050 %- Make calculations always in 3D
0051 %
0052 pos                 = zeros(1,3);
0053 pos(1:dim)          = ppos;
0054 %
0055 los                 = zeros(1,2);
0056 los(1:length(plos)) = plos;
0057 %
0058 if dim == 2
0059   los(1) = abs( los(1) );
0060   if plos(1) < 0
0061     los(2) = 180;
0062   end
0063 end
0064 
0065 
0066 
0067 %- Length from path point to sensor radius
0068 %
0069 r_tan = pos(1)*sind( los(1) );
0070 r2    = r_tan * r_tan;
0071 % Distance to tangent point:
0072 l     = sqrt( r_sensor*r_sensor - r2 ); 
0073 % Add or remove distance to tangent point
0074 if los(1) ~= 90
0075   l     = l - sign(los(1)-90)*sqrt( pos(1)*pos(1) - r2 );
0076 end
0077 
0078 %- Position and LOS of sensor
0079 %
0080 spos = zeros(1,3);
0081 slos = zeros(1,2);
0082 %
0083 [x,y,z,dx,dy,dz] = geocentricposlos2cart( pos(1), pos(2), pos(3), ...
0084                                           los(1), los(2) );
0085 %
0086 [spos(1),spos(2),spos(3),slos(1),slos(2)] = ...
0087                    cartposlos2geocentric( x-l*dx, y-l*dy, z-l*dz, dx, dy, dz );
0088 
0089 
0090 %--- dim < 3 specific stuff
0091 %
0092 if dim == 1
0093   %
0094   spos = spos(1);
0095   slos = slos(1);
0096 
0097 elseif dim == 2
0098   %
0099   spos = spos(1:2);
0100   slos = slos(1);
0101   
0102   % Handle special case of negative zenith angle for 2D
0103   if spos(2) > ppos(2)
0104     slos = -slos;
0105   end
0106 end

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