Home > atmlab > geophysics > p2z_cira86.m

p2z_cira86

PURPOSE ^

P2Z_CIRA86 Converts pressure to altitude and temperature

SYNOPSIS ^

function [z,t]=p2z_cira86(p,lat,doy)

DESCRIPTION ^

 P2Z_CIRA86    Converts pressure to altitude and temperature

    Converts pressure to altitude and temperature assuming cira86
    climataology. Linear interpolation between log(pressure),
    latitude, and day of year is performed.

 FORMAT   [Z,T] = p2z_cira86( P , LAT , DOY )
        
 OUT   Z     Altitude in meter, for all combinations of P, LAT, DOY 
             Size is [np,nlat,ndoy]
       T     Temperature in kelvin, for all combinations of P, LAT, DOY 
             Size is [nz,nlat,ndoy]
 IN    P     Pressure in pascal. Can be a scalar or column vector
       LAT   Latitude. Can be a scalar or column vector [-90 to 90].
       DOY   Day of year. Can be a scalar or column vector

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

p2z_cira86.m

SOURCE CODE ^

0001 % P2Z_CIRA86    Converts pressure to altitude and temperature
0002 %
0003 %    Converts pressure to altitude and temperature assuming cira86
0004 %    climataology. Linear interpolation between log(pressure),
0005 %    latitude, and day of year is performed.
0006 %
0007 % FORMAT   [Z,T] = p2z_cira86( P , LAT , DOY )
0008 %
0009 % OUT   Z     Altitude in meter, for all combinations of P, LAT, DOY
0010 %             Size is [np,nlat,ndoy]
0011 %       T     Temperature in kelvin, for all combinations of P, LAT, DOY
0012 %             Size is [nz,nlat,ndoy]
0013 % IN    P     Pressure in pascal. Can be a scalar or column vector
0014 %       LAT   Latitude. Can be a scalar or column vector [-90 to 90].
0015 %       DOY   Day of year. Can be a scalar or column vector
0016 
0017 % 2007-11-01   Created by Bengt Rydberg
0018 
0019 function [z,t]=p2z_cira86(p,lat,doy)
0020                                                                    %&%
0021 rqre_datatype( p, @istensor1 );                                    %&%
0022 rqre_datatype( lat, @istensor1 );                                  %&%
0023 rqre_datatype( doy, @istensor1 );                                  %&%
0024 if any(doy)>367 | any(doy<1)                                       %&%
0025   error('doy range is [1,367]')                                    %&%
0026 end                                                                %&%
0027 if any(lat)>90 | any(lat<-90)                                      %&%
0028    error('latitude range is -90 to 90')                            %&%
0029 end                                                                %&%
0030 
0031 % Create a a mjd matching the given doy (ie. the inverse of mjd2doy)
0032 mjd = date2mjd( 2000, 1, 1, 0, 0, 0 ) + doy - 1;
0033 
0034 
0035 cira86 = fullfile( atmlab('ARTS_XMLDATA_PATH'), 'climatology', 'cira86', ...
0036                                                                'cira86.z.xml' );
0037 
0038 G = gf_artsxml( cira86, 'CIRA86', 'z_field' );
0039 
0040 G = atmdata_regrid( G, { p, lat, 0, mjd } );
0041 
0042 if length(mjd) > 1
0043   z = reshape( G.DATA, [size(G.DATA,1), size(G.DATA,2), size(G.DATA,4)] );
0044 else
0045   z = G.DATA;
0046 end
0047 
0048 if nargout > 1
0049   cira86 = fullfile( atmlab('ARTS_XMLDATA_PATH'), 'climatology', 'cira86', ...
0050                                                                'cira86.t.xml' );
0051   G = gf_artsxml( cira86, 'CIRA86', 't_field' );
0052 
0053   G = atmdata_regrid( G, { p, lat, 0, mjd } );
0054 
0055   if length(mjd) > 1
0056     t = reshape( G.DATA, [size(G.DATA,1), size(G.DATA,2), size(G.DATA,4)] );
0057   else
0058     t = G.DATA;
0059   end
0060 end

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