Home > atmlab > gridcreation > profile_refine.m

profile_refine

PURPOSE ^

PROFILE_REFINE Refine atmospheric profiles by adding additional grid

SYNOPSIS ^

function rprofs = profile_refine(profs, delta_ln_p)

DESCRIPTION ^

 PROFILE_REFINE Refine atmospheric profiles by adding additional grid
 points.

 This function is intended for the interpolation of atmospheric profiles
 to a finer vertical grid. It uses GRID_REFINE to find the actual points
 for the new grid. 

 The input variable profs holds the profile data, where each column is a
 quantity (p,t,z,vmrs,...) and each row corresponds to a pressure level.

 The first column must hold the pressure profile, which is used for the
 interpolation of the other columns. The interpolation is done in ln(p),
 consistent with the general ARTS standard.

 See also: GRID_REFINE, which does most of the difficult work here.

 FORMAT rprofs = profile_refine(profs, delta_ln_p)

 OUT   rprofs       Profiles interpolated to the new grid.
 IN    profs        The profiles to interpolate.
       delta_ln_p   Desired maximum grid spacing. This must be in ln(Pa)
                    units!

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

profile_refine.m

SOURCE CODE ^

0001 % PROFILE_REFINE Refine atmospheric profiles by adding additional grid
0002 % points.
0003 %
0004 % This function is intended for the interpolation of atmospheric profiles
0005 % to a finer vertical grid. It uses GRID_REFINE to find the actual points
0006 % for the new grid.
0007 %
0008 % The input variable profs holds the profile data, where each column is a
0009 % quantity (p,t,z,vmrs,...) and each row corresponds to a pressure level.
0010 %
0011 % The first column must hold the pressure profile, which is used for the
0012 % interpolation of the other columns. The interpolation is done in ln(p),
0013 % consistent with the general ARTS standard.
0014 %
0015 % See also: GRID_REFINE, which does most of the difficult work here.
0016 %
0017 % FORMAT rprofs = profile_refine(profs, delta_ln_p)
0018 %
0019 % OUT   rprofs       Profiles interpolated to the new grid.
0020 % IN    profs        The profiles to interpolate.
0021 %       delta_ln_p   Desired maximum grid spacing. This must be in ln(Pa)
0022 %                    units!
0023 
0024 % 2010-07-02 Created by Stefan Buehler
0025 
0026 function rprofs = profile_refine(profs, delta_ln_p)
0027 
0028 % Get pressure grid. Note the ln!
0029 lnp = log(profs(:,1));
0030 
0031 % We do no error checking on p here, since this is done by
0032 % grid_refine.
0033 
0034 % But check the delta_ln_p value to catch some of the cases where
0035 % the user uses pressure directly. (An ln(Pa) of 10 correspons
0036 % roughly to an altitude difference of 70 km.)
0037 if delta_ln_p > 10
0038     error(['You specified an extremely larege delta_ln_p value. ',...
0039            'Are you sure that your value is in ln(Pa) units?']);
0040 end
0041 
0042 % Get data to interpolate.
0043 data = profs(:,2:end);
0044 
0045 % Refine log-p grid.
0046 lnp_refined = grid_refine(lnp, delta_ln_p);
0047 
0048 % Do the interpolation.
0049 data_refined = interp1(lnp, data, lnp_refined);
0050 
0051 % Store grid and data in output variable rprofs.
0052 % Note the exp()!
0053 rprofs = [exp(lnp_refined), data_refined];
0054

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