Home > atmlab > geophysics > tropopause.m

tropopause

PURPOSE ^

TROPOPAUSE Determines the tropopause height

SYNOPSIS ^

function z = tropopause(Z,T,varargin)

DESCRIPTION ^

 TROPOPAUSE   Determines the tropopause height 

    The WMO definition of the tropopause: "The lowest level at which the lapse
    rate decreases to 2 C/km or less, provided that the average lapse rate
    between this level and all higher levels within 2 km does not exceed 
    2 C/km." 

    This function makes a simplified search of this altitude. Only the part
    "The lowest level at which the lapse rate decreases to 2 C/km" is here
    considered. More precisely, the function returns the lowest altitude with a
    local lapse rate below 2 K/km, inside the range limited of *zmin* and
    *zmax*. If the lapse rate limit is outside this range, z is set to to
    either *zmin* or *zmax* (depending on size of lapse rate between (*zmin*
    and *zmax*).

    The function works for smooth (climatological) profiles, but can not
    be applied on structured temperature profiles.

    The "columns" (dim 1) of *Z* and *T* are taken as profiles for different
    locations. *Z* and *T* can have a dimensionality <= 3.

 FORMAT   z = tropopause(Z,T[,zmin,zmax,lrlim])
        
 OUT   z       Row vector with tropopause heights.
 IN    Z       Altitude vectors.
       T       Temperature profiles.
 OPT   zmin    Lowest possible altitude for tropopause. Default is 6 km.
       zmax    Highest possible altitude for tropopause. Deafult is 20 km.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

tropopause.m

SOURCE CODE ^

0001 % TROPOPAUSE   Determines the tropopause height
0002 %
0003 %    The WMO definition of the tropopause: "The lowest level at which the lapse
0004 %    rate decreases to 2 C/km or less, provided that the average lapse rate
0005 %    between this level and all higher levels within 2 km does not exceed
0006 %    2 C/km."
0007 %
0008 %    This function makes a simplified search of this altitude. Only the part
0009 %    "The lowest level at which the lapse rate decreases to 2 C/km" is here
0010 %    considered. More precisely, the function returns the lowest altitude with a
0011 %    local lapse rate below 2 K/km, inside the range limited of *zmin* and
0012 %    *zmax*. If the lapse rate limit is outside this range, z is set to to
0013 %    either *zmin* or *zmax* (depending on size of lapse rate between (*zmin*
0014 %    and *zmax*).
0015 %
0016 %    The function works for smooth (climatological) profiles, but can not
0017 %    be applied on structured temperature profiles.
0018 %
0019 %    The "columns" (dim 1) of *Z* and *T* are taken as profiles for different
0020 %    locations. *Z* and *T* can have a dimensionality <= 3.
0021 %
0022 % FORMAT   z = tropopause(Z,T[,zmin,zmax,lrlim])
0023 %
0024 % OUT   z       Row vector with tropopause heights.
0025 % IN    Z       Altitude vectors.
0026 %       T       Temperature profiles.
0027 % OPT   zmin    Lowest possible altitude for tropopause. Default is 6 km.
0028 %       zmax    Highest possible altitude for tropopause. Deafult is 20 km.
0029 
0030 % 2007-03-01   Created by Patrick Eriksson
0031 
0032 
0033 function z = tropopause(Z,T,varargin)
0034 %
0035 [zmin,zmax] = optargs( varargin, { 6e3, 20e3 } );
0036 
0037 %-- Hard coded values
0038 %
0039 lrlim = 2;   % Lapse rate limit. WMO definition corresponds to 2
0040                                                                            %&%
0041                                                                            %&%
0042 %- Check input                                                             %&%
0043 %                                                                          %&%
0044 rqre_nargin( 2, nargin )                                                   %&%
0045 %                                                                          %&%
0046 rqre_datatype( Z, {@istensor3} );                                          %&%
0047 rqre_datatype( T, {@istensor3} );                                          %&%
0048 %                                                                          %&%
0049 rqre_datatype( zmin, {@istensor0} );                                       %&%
0050 rqre_in_range( zmin, 0, 20e3 );                                            %&%
0051 rqre_datatype( zmax, {@istensor0} );                                       %&%
0052 rqre_in_range( zmax, 0, 20e3 );                                            %&%
0053 %                                                                          %&%
0054 if any( size(Z) ~= size(T) )                                               %&%
0055   error( 'Mismatch in size between *Z* and *T*.' );                        %&%
0056 end                                                                        %&%
0057 if any( Z(1,:,:) > zmin )                                                  %&%
0058   error( 'Not all altitide profiles cover *zmin*.' );                      %&%
0059 end                                                                        %&%
0060 if any( Z(end,:,:) < zmax )                                                %&%
0061   error( 'Not all altitide profiles cover *zmax*.' );                      %&%
0062 end                                                                        %&%
0063 
0064 
0065 
0066 %- Allocate output variables
0067 %
0068 n    = [ size( Z ) 1 ];   % To ensure that length(n)>= 3
0069 np   = n(1);
0070 n(1) = 1;
0071 %
0072 z  = repmat( NaN, n );
0073 t0 = repmat( NaN, n );
0074 
0075 
0076 for i2 = 1:n(2)
0077   for i3 = 1:n(3)
0078     
0079     %- Calculate lapse rate between grid points
0080     %
0081     zp = edges2grid( Z(:,i2,i3) );
0082     lr = -1e3 * ( diff(T(:,i2,i3)) ./ diff(Z(:,i2,i3)) );
0083     
0084     %- Find part inside [zmin,zmax]
0085     %
0086     ind = find( zp >= zmin  &  zp <= zmax );
0087     %
0088     % Expand one step in each direction, to cover zmin and zmax
0089     ind = max([1 ind(1)-1]) : min([np-1 ind(end)+1]);
0090     
0091     % Find lowest point below *lrlim*
0092     %
0093     ip = min(find(lr(ind)<2 ));
0094       
0095     %- Pick out altitude
0096     %
0097     if isempty(ip)
0098       z(i2,i3) = zmax;
0099     elseif ip == 1
0100       z(i2,i3) = zmin;
0101     else
0102       ind      = ind( [ ip + [-1 0] ] );
0103       z(i2,i3) = interp1( lr(ind), zp(ind), lrlim );
0104     end
0105     
0106   end
0107 end
0108 
0109 
0110

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