function GetSeaLevelPressure(StnPressure, Altitude, TDryBulb) result(SeaLevelPressure)
!+ Return sea level pressure given dry-bulb temperature, altitude above sea level and pressure.
!+ Reference:
!+ Hess SL, Introduction to theoretical meteorology, Holt Rinehart and Winston, NY 1959,
!+ ch. 6.5; Stull RB, Meteorology for scientists and engineers, 2nd edition,
!+ Brooks/Cole 2000, ch. 1.
!+ Notes:
!+ The standard procedure for the US is to use for TDryBulb the average
!+ of the current station temperature and the station temperature from 12 hours ago.
real, intent(in) :: StnPressure
!+ Observed station pressure in Psi [IP] or Pa [SI]
real, intent(in) :: Altitude
!+ Altitude in ft [IP] or m [SI]
real, intent(in) :: TDryBulb
!+ Dry-bulb temperature in °F [IP] or °C [SI]
real :: SeaLevelPressure
!+ Sea level barometric pressure in Psi [IP] or Pa [SI]
real :: TColumn
!+ Average temperature in column of air in R [IP] or K [SI]
real :: H
!+ scale height (dimensionless)
if (isIP()) then
! Calculate average temperature in column of air, assuming a lapse rate
! of 3.6 °F/1000ft
TColumn = TDryBulb + 0.0036 * Altitude / 2.0
! Determine the scale height
H = 53.351 * GetTRankineFromTFahrenheit(TColumn)
else
! Calculate average temperature in column of air, assuming a lapse rate
! of 6.5 °C/km
TColumn = TDryBulb + 0.0065 * Altitude / 2.0
! Determine the scale height
H = 287.055 * GetTKelvinFromTCelsius(TColumn) / 9.807
end if
! Calculate the sea level pressure
SeaLevelPressure = StnPressure * exp(Altitude / H)
end function GetSeaLevelPressure