Home > atmlab > forwardmodel > satviewdepth.m

satviewdepth

PURPOSE ^

SATVIEWDEPTH Satellite viewing depth

SYNOPSIS ^

function zs = satviewdepth(z,Abs,ztan,varargin)

DESCRIPTION ^

 SATVIEWDEPTH   Satellite viewing depth

    Calculates how far down into the atmosphere "can see". The viewing
    depth is based on the optical thickness, calculated from the top of
    the atmosphere and downwards. The atmosphere top is defined by the 
    highest altitude for which absorption is provided.

    Refraction is not considered. In this case, the propagation path is
    best described by the tangent altitude. Down-looking cases correspond
    to negative tangent altitudes.

 FORMAT   zs = satviewdepth(z,Abs,ztan[,tau,Re])
        
 OUT   zs    Viewing altitude, for each combination of frequency and tangent
             altitudes ([ztan,f]).
 IN    z     Altitudes for absorption.
       Abs   Absorption, where each column corresponds to an altitude.
       ztan  Tangent altitude(s).
 OPT   tau   Definition of view limit, in optical thickness. Default is 1.
       Re    Earth radius. Defualt is taken from *constants*.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

satviewdepth.m

SOURCE CODE ^

0001 % SATVIEWDEPTH   Satellite viewing depth
0002 %
0003 %    Calculates how far down into the atmosphere "can see". The viewing
0004 %    depth is based on the optical thickness, calculated from the top of
0005 %    the atmosphere and downwards. The atmosphere top is defined by the
0006 %    highest altitude for which absorption is provided.
0007 %
0008 %    Refraction is not considered. In this case, the propagation path is
0009 %    best described by the tangent altitude. Down-looking cases correspond
0010 %    to negative tangent altitudes.
0011 %
0012 % FORMAT   zs = satviewdepth(z,Abs,ztan[,tau,Re])
0013 %
0014 % OUT   zs    Viewing altitude, for each combination of frequency and tangent
0015 %             altitudes ([ztan,f]).
0016 % IN    z     Altitudes for absorption.
0017 %       Abs   Absorption, where each column corresponds to an altitude.
0018 %       ztan  Tangent altitude(s).
0019 % OPT   tau   Definition of view limit, in optical thickness. Default is 1.
0020 %       Re    Earth radius. Defualt is taken from *constants*.
0021 
0022 % 2006-04-26   Created by Parick Eriksson.
0023 
0024 
0025 function zs = satviewdepth(z,Abs,ztan,varargin)
0026 %
0027 [tau,Re] = optargs( varargin, { 1, constants('EARTH_RADIUS') } );
0028                                                                            %&%
0029                                                                            %&%
0030 %- Check input                                                             %&%
0031 %                                                                          %&%
0032 rqre_nargin( 3, nargin )                                                   %&%
0033 %                                                                          %&%
0034 rqre_datatype( z, {@istensor1} );                                          %&%
0035 rqre_datatype( Abs, {@istensor2} );                                        %&%
0036 rqre_datatype( ztan, {@istensor1} );                                       %&%
0037 %                                                                          %&%
0038 rqre_datatype( tau, {@istensor0} );                                        %&%
0039 rqre_in_range( tau, 0 );                                                   %&%
0040 rqre_datatype( Re, {@istensor0} );                                         %&%
0041 rqre_in_range( Re, 0 );                                                    %&%
0042 %                                                                          %&%
0043 if ~issorted(z)                                                            %&%
0044   error('Argument *z* must be a sorted increasing vector.');               %&%
0045 end                                                                        %&%
0046 if length(z) ~= size(Abs,2)                                                %&%
0047   error('Size mismatch between *z* and *Abs*.');                           %&%
0048 end                                                                        %&%
0049 
0050 
0051 %= Return argument
0052 %
0053 zs = zeros( length(ztan), size(Abs,1) );
0054 
0055 
0056 %= Loop tangent altitudes
0057 %
0058 for j = 1:length(ztan)
0059 
0060 
0061   %= Matrix of cumulative optical depths
0062   %
0063   Tau = zeros( size(Abs) );
0064   %
0065   ind = 1:size(Abs,2);
0066 
0067   %= Loop downwards
0068   %
0069   for i = size(Abs,2)-1:-1:1
0070 
0071      %- Above tangent altitude
0072      %
0073      if z(i) > ztan(j)  
0074        l        = sqrt( (Re+z(i+1)).^2 - (Re+ztan(j))^2 ) - ...
0075                                          sqrt( (Re+z(i)).^2 - (Re+ztan(j))^2 );
0076        Tau(:,i) = Tau(:,i+1) +   l * (Abs(:,i+1)+Abs(:,i))/2; 
0077 
0078    
0079      %- Below tangent altitude
0080      %
0081      else
0082        l            = sqrt( (Re+z(i+1)).^2 - (Re+ztan(j))^2 );
0083        Tau(:,i)     = Tau(:,i+1) + l * (Abs(:,i+1)+interp1(z,Abs',ztan(j))')/2;
0084        ind          = i:ind(end);
0085        break
0086      end
0087   end
0088 
0089 
0090   %= Interpolate in tau
0091   %
0092   for i = 1:size(Abs,1)
0093     zs(j,i) = interp1( Tau(i,ind), z(ind), tau );
0094   end
0095 
0096 end

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