Home > atmlab > arts > qarts_hse.m

qarts_hse

PURPOSE ^

QARTS_HSE Calculation of hydrostatic altitudes

SYNOPSIS ^

function Z = qarts_hse( Q, hse_p, hse_z )

DESCRIPTION ^

 QARTS_HSE   Calculation of hydrostatic altitudes

    An interface for Qarts to *pt2z*. The main usage should be:
       Q.Z_FIELD = qarts_hse( Q, hse_p, hse_t );

    The altitudes are calculated using the following fields of Q:
       P_GRID
       T_FIELD
       VMR_FIELD
       ABS_SPECIES, that must contain data for H2O. 

    In addition, LAT_GRID, or LAT_TRUE for 1D and 2D, must be set.

 FORMAT   Z = qarts_hse( Q, hse_p, hse_z )
        
 OUT   Z       Calculated altitudes.
 IN    Q       Qarts setting structure.
       hse_p   Pressure of reference point [Pa].
       hse_z   Altitude of reference point [m].

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

qarts_hse.m

SOURCE CODE ^

0001 % QARTS_HSE   Calculation of hydrostatic altitudes
0002 %
0003 %    An interface for Qarts to *pt2z*. The main usage should be:
0004 %       Q.Z_FIELD = qarts_hse( Q, hse_p, hse_t );
0005 %
0006 %    The altitudes are calculated using the following fields of Q:
0007 %       P_GRID
0008 %       T_FIELD
0009 %       VMR_FIELD
0010 %       ABS_SPECIES, that must contain data for H2O.
0011 %
0012 %    In addition, LAT_GRID, or LAT_TRUE for 1D and 2D, must be set.
0013 %
0014 % FORMAT   Z = qarts_hse( Q, hse_p, hse_z )
0015 %
0016 % OUT   Z       Calculated altitudes.
0017 % IN    Q       Qarts setting structure.
0018 %       hse_p   Pressure of reference point [Pa].
0019 %       hse_z   Altitude of reference point [m].
0020 
0021 % 2009-07-01   Created by Patrick Eriksson.
0022 
0023 function Z = qarts_hse( Q, hse_p, hse_z )
0024                                                                             %&%
0025 rqre_nargin( 3, nargin );                                                   %&%
0026 rqre_datatype( hse_p, @istensor0 );                                         %&%
0027 rqre_datatype( hse_z, @istensor0 );                                         %&%
0028 if ~qarts_isset( Q.P_GRID )                                                 %&%
0029   error( 'Q.P_GRID must be set when using this function' );                 %&%
0030 end                                                                         %&%
0031 if Q.ATMOSPHERE_DIM < 3  &&  ~qarts_isset( Q.LAT_TRUE )                     %&%
0032   error( 'Q.LAT_TRUE must be set when using this function for 1D and 2D.' );%&%
0033 end                                                                         %&%
0034 if Q.ATMOSPHERE_DIM == 3  &&  ~qarts_isset( Q.LAT_GRID )                    %&%
0035   error( 'Q.LAT_GRID must be set when using this function for 3D.' );       %&%
0036 end                                                                         %&%
0037 if ~qarts_isset( Q.T_FIELD     )                                            %&%
0038   error( 'Q.T_FIELD must be set when using this function' );                %&%
0039 end                                                                         %&%
0040 if ~qarts_isset( Q.VMR_FIELD )                                              %&%
0041   error( 'Q.VMR_FIELD must be set when using this function' );              %&%
0042 end                                                                         %&%
0043 if ~qarts_isset( Q.ABS_SPECIES )                                            %&%
0044   error( 'Q.ABS_SPECIES must be set when using this function' );            %&%
0045 end                                                                         %&%
0046 
0047 %- Find first H2O among ABS_SPECIES
0048 ih2o = [];
0049 %
0050 for i = 1 : length( Q.ABS_SPECIES )
0051   if strcmp( lower(arts_tgs2species(Q.ABS_SPECIES(i).TAG{1})), 'h2o' )
0052     ih2o = i;
0053     break;
0054   end
0055 end
0056 if isempty( ih2o )                                                          %&%
0057   error( 'H2O must be included among ABS_SPECIES.' );                       %&%
0058 end                                                                         %&%
0059 
0060 
0061 T        = qarts_get( Q.T_FIELD );
0062 VMR      = qarts_get( Q.VMR_FIELD );
0063 p_grid   = qarts_get( Q.P_GRID );
0064 if Q.ATMOSPHERE_DIM < 3  
0065   lat_grid = qarts_get( Q.LAT_TRUE );
0066 else
0067   lat_grid = qarts_get( Q.LAT_GRID );
0068 end
0069   
0070 
0071 rqre_gridmatch( T, 1, p_grid );                                             %&%
0072 rqre_gridmatch( T, 2, lat_grid );                                           %&%
0073 rqre_gridmatch( VMR, 2, p_grid );                                           %&%
0074 rqre_gridmatch( VMR, 3, lat_grid );                                         %&%
0075 
0076 
0077 Z = zeros( size( T ) );
0078 %
0079 for ilon = 1 : size( T, 3 )
0080   for ilat = 1 : size( T, 2 )
0081 
0082     Z(:,ilat,ilon) = pt2z( p_grid, T(:,ilat,ilon), ...
0083                            getdims(VMR(ih2o,:,ilat,ilon),2), ...
0084                            hse_p, hse_z, lat_grid(ilat) );  
0085   end
0086 end

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