BoundaryAlt
MATLAB
`hh = BoundaryAlt(h,hInt,hhInt)`

Maps input altitudes in the interval [hInt(1) hInt(2)] into altitudes in the interval [hhInt(1) hhInt(2)].

Intended to facilitate using atmospheric models in the earth's boundary layer where certain altitudes should be referenced to ground level, and other altitudes should be referenced to sea level. Generally, hInt(end) = hhInt(end) = boundary-layer altitude limit. However, code will accept other inputs and use them accordingly. Altitudes in interval hInt are set according to: hh = hhInt(1)+(diff(hhInt)/diff(hInt)).*(h-hInt(1)); Input altitudes less than hInt(1) are set to hhInt(1).

 Parameters Description h [vector] Altitude above sea level (m) hInt [array] Altitude interval for mapping (m). Can be of size 1 x NumLayers+1 or NScreens x NumLayers+1. hhInt [array] Altitude interval for output (m). Can be of size 1 x NumLayers+1 or NScreens x NumLayers+1.
 Return Values Description hh [vector] Mapped altitudes (m)

>> hh = BoundaryAlt([0 2500 6000],[0 5000],[1230 5000])

• Map altitudes from 0 to 5000 m to a range of 1230 to 5000 m. This could be used to map altitudes above ground to altitudes above MSL, keeping boundary layer altitude fixed. Note that hh(1) = 1230.
>> hh = BoundaryAlt([1230 2500 6000],[1230 5000],[0 5000])

• Map altitudes from 1230 to 5000 m to a range of 0 to 5000 m. This could be used to map altitudes above MSL to altitudes above ground, keeping boundary layer altitude fixed. Note that hh(1) = 0.
>> GndAlt = rand(10,1)*500+500;

>> h = EarthAlt((0.05:0.1:0.95)',1000,5000,10000);

>> hh = BoundaryAlt(h,[GndAlt repmat(5000,10,1)],[0 5000]);

>> figure; plot((0.05:0.1:0.95),[hh,h,GndAlt])

• Scales altitudes between ground level and 5 km to be between 0 and 5 km. GndAlt is generated randomly between 500 and 1000 m.